dovecot-2.1-pigeonhole: testsuite: editheader extension: added v...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Sat Nov 26 15:19:57 EET 2011


details:   http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/23fbd8454d98
changeset: 1559:23fbd8454d98
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sat Nov 26 14:19:42 2011 +0100
description:
testsuite: editheader extension: added various tests for folded headers.

diffstat:

 tests/extensions/editheader/addheader.svtest    |  160 ++++++++++++++++++++++++++-
 tests/extensions/editheader/deleteheader.svtest |   60 ++++++++++
 2 files changed, 219 insertions(+), 1 deletions(-)

diffs (247 lines):

diff -r f7ec0ff8c3ba -r 23fbd8454d98 tests/extensions/editheader/addheader.svtest
--- a/tests/extensions/editheader/addheader.svtest	Sat Nov 26 14:19:09 2011 +0100
+++ b/tests/extensions/editheader/addheader.svtest	Sat Nov 26 14:19:42 2011 +0100
@@ -202,7 +202,6 @@
 	}
 }
 
-
 test_result_reset;
 test_set "message" "${message}";
 test "Addheader - framed" {
@@ -321,3 +320,162 @@
 	}
 }
 
+/*
+ * Addheader - folded
+ */
+
+test_result_reset;
+test_set "message" "${message}";
+test "Addheader - folded" {
+	set "before"
+		"This is very long header content, folded to fit inside multiple header lines. This may cause problems, so that is why it is tested here.";
+	set "after"
+		"This is somewhat longer header content, folded to fit inside multiple header lines. This may cause problems, so that is why it is tested here.";
+
+	addheader "X-Some-Header-first" "${before}";	
+	addheader :last "X-Some-Header-last" "${after}";
+
+	if not header :is "subject" "Frop!" {
+		test_fail "original subject header not retained";
+	}
+
+	if not exists "x-some-header-first" {
+		test_fail "first header not added";
+	}
+
+	if not exists "x-some-header-last" {
+		test_fail "last header not added";
+	}
+
+	if not header :is "x-some-header-first" "${before}" {
+		test_fail "wrong first content added";
+	}
+
+	if not header :is "x-some-header-last" "${after}" {
+		test_fail "wrong last content added";
+	}
+
+	redirect "frop at example.com";
+
+	if not test_result_execute {
+		test_fail "failed to execute result";
+	}
+
+	if not test_message :smtp 0 {
+		test_fail "message not redirected";
+	}
+
+	if not header :is "subject" "Frop!" {
+		test_fail "original subject header not retained in redirected mail";
+	}	
+
+	if not exists "x-some-header-first" {
+		test_fail "first header not in redirected mail";
+	}
+
+	if not exists "x-some-header-last" {
+		test_fail "last header not in redirected mail";
+	}
+
+	if not header :is "x-some-header-first" "${before}" {
+		test_fail "wrong first header content in redirected mail ";
+	}
+
+	if not header :is "x-some-header-last" "${after}" {
+		test_fail "wrong last header content in redirected mail ";
+	}
+
+	if not body :matches "Frop!*" {
+		test_fail "body not retained in redirected mail";
+	}
+}
+
+/*
+ * Addheader - newlines
+ */
+
+test_result_reset;
+test_set "message" "${message}";
+test "Addheader - newlines" {
+	set "before" text:
+This is very long header content
+ containing newlines. This may
+ cause some problems, so that
+ is why it is tested here.
+.
+;
+
+	set "after" text:
+This is somewhat longer header content
+ containing newlines. This may
+ cause some problems, so that
+ is why it is tested here.
+.
+;
+
+	set "before_out"
+		"This is very long header content containing newlines. This may cause some problems, so that is why it is tested here.";
+
+	set "after_out"
+		"This is somewhat longer header content containing newlines. This may cause some problems, so that is why it is tested here.";
+
+	addheader "X-Some-Header-first" "${before}";	
+	addheader :last "X-Some-Header-last" "${after}";
+
+	if not header :is "subject" "Frop!" {
+		test_fail "original subject header not retained";
+	}
+
+	if not exists "x-some-header-first" {
+		test_fail "first header not added";
+	}
+
+	if not exists "x-some-header-last" {
+		test_fail "last header not added";
+	}
+
+	if not header :is "x-some-header-first" "${before_out}" {
+		test_fail "wrong first content added";
+	}
+
+	if not header :is "x-some-header-last" "${after_out}" {
+		test_fail "wrong last content added";
+	}
+
+	redirect "frop at example.com";
+
+	if not test_result_execute {
+		test_fail "failed to execute result";
+	}
+
+	if not test_message :smtp 0 {
+		test_fail "message not redirected";
+	}
+
+	if not header :is "subject" "Frop!" {
+		test_fail "original subject header not retained in redirected mail";
+	}	
+
+	if not exists "x-some-header-first" {
+		test_fail "first header not in redirected mail";
+	}
+
+	if not exists "x-some-header-last" {
+		test_fail "last header not in redirected mail";
+	}
+
+	if not header :is "x-some-header-first" "${before_out}" {
+		test_fail "wrong first header content in redirected mail ";
+	}
+
+	if not header :is "x-some-header-last" "${after_out}" {
+		test_fail "wrong last header content in redirected mail ";
+	}
+
+	if not body :matches "Frop!*" {
+		test_fail "body not retained in redirected mail";
+	}
+}
+
+
+
diff -r f7ec0ff8c3ba -r 23fbd8454d98 tests/extensions/editheader/deleteheader.svtest
--- a/tests/extensions/editheader/deleteheader.svtest	Sat Nov 26 14:19:09 2011 +0100
+++ b/tests/extensions/editheader/deleteheader.svtest	Sat Nov 26 14:19:42 2011 +0100
@@ -825,9 +825,69 @@
 }
 
 
+/*
+ *
+ */
 
+test_result_reset;
 
+test_set "message" text:
+X-A: Long folded header to test removal of folded
+ headers from a message. This is the top header.
+X-B: First intermittent unfolded header
+X-A: Long folded header to test removal of folded
+ headers from a message. This is the middle header.
+X-B: Second intermittent unfolded header
+X-A: Long folded header to test removal of folded
+ headers from a message. This is the bottom header,
+ which concludes the header of this message.
 
+Frop!
+.
+;
 
+test "Deleteheader - :matches" {
+	deleteheader "X-A";
 
+	if exists "X-A" {
+		test_fail "original X-A (1) header not deleted";
+	}
 
+	if not header :is "X-B" "First intermittent unfolded header" {
+		test_fail "original X-B (2) header not retained";
+	}
+
+	if not header :is "X-B" "Second intermittent unfolded header" {
+		test_fail "original X-B (2) header not retained";
+	}
+
+	if not body :matches "Frop!*" {
+		test_fail "body not retained in redirected mail";
+	}
+
+	redirect "frop at example.com";
+
+	if not test_result_execute {
+		test_fail "failed to execute result";
+	}
+
+	if not test_message :smtp 0 {
+		test_fail "message not redirected";
+	}
+
+	if exists "X-A" {
+		test_fail "original X-A (1) header not deleted in redirected mail";
+	}
+
+	if not header :is "X-B" "First intermittent unfolded header" {
+		test_fail "original X-B (2) header not retained in redirected mail";
+	}
+
+	if not header :is "X-B" "Second intermittent unfolded header" {
+		test_fail "original X-B (2) header not retained in redirected mail";
+	}
+
+	if not body :matches "Frop!*" {
+		test_fail "body not retained in redirected mail";
+	}
+}


More information about the dovecot-cvs mailing list