From: Menno Smits Date: Tue, 7 Apr 2015 15:16:29 +0000 (+0900) Subject: Extended and cleaned up ENVELOPE tests X-Git-Tag: 0.13~1^2~20 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=145cb0ff36dfb75f4dfe4363a210c150e602cbe3;p=imapclient.git Extended and cleaned up ENVELOPE tests --- diff --git a/imapclient/test/test_response_parser.py b/imapclient/test/test_response_parser.py index 2d3ce91..1b6c596 100644 --- a/imapclient/test/test_response_parser.py +++ b/imapclient/test/test_response_parser.py @@ -327,13 +327,15 @@ class TestParseFetchResponse(unittest.TestCase): envelope_str = (b'1 (ENVELOPE ( ' b'"Sun, 24 Mar 2013 22:06:10 +0200" ' b'"subject" ' - b'(("name" NIL "address1" "domain1.com")) ' - b'((NIL NIL "address2" "domain2.com")) ' - b'(("name" NIL "address3" "domain3.com")) ' - b'NIL' - b'((NIL NIL "address4" "domain4.com") ' + b'(("name" NIL "address1" "domain1.com")) ' # from (name and address) + b'((NIL NIL "address2" "domain2.com")) ' # sender (just address) + b'(("name" NIL "address3" "domain3.com") NIL) ' # reply to + b'NIL' # to (no address) + b'((NIL NIL "address4" "domain4.com") ' # cc b'("person" NIL "address4b" "domain4b.com")) ' - b'NIL "" ""))') + b'NIL ' # bcc + b'"" ' + b'""))') output = parse_fetch_response([envelope_str], normalise_times=False) @@ -352,16 +354,19 @@ class TestParseFetchResponse(unittest.TestCase): ) def test_ENVELOPE_with_no_date(self): - envelope_str = (b'1 (ENVELOPE ( ' + envelope_str = ( + b'1 (ENVELOPE ( ' b'NIL ' b'"subject" ' - b'(("name" NIL "address1" "domain1.com")) ' - b'((NIL NIL "address2" "domain2.com")) ' - b'(("name" NIL "address3" "domain3.com")) ' - b'NIL' - b'((NIL NIL "address4" "domain4.com") ' - b'("person" NIL "address4b" "domain4b.com")) ' - b'NIL "" ""))') + b'NIL ' + b'NIL ' + b'NIL ' + b'NIL ' + b'NIL ' + b'NIL ' + b'"" ' + b'""))' + ) output = parse_fetch_response([envelope_str], normalise_times=False) @@ -369,23 +374,23 @@ class TestParseFetchResponse(unittest.TestCase): Envelope( None, b"subject", - (Address(b"name", None, b"address1", b"domain1.com"),), - (Address(None, None, b"address2", b"domain2.com"),), - (Address(b"name", None, b"address3", b"domain3.com"),), None, - (Address(None, None, b"address4", b"domain4.com"), - Address(b"person", None, b"address4b", b"domain4b.com")), - None, b"", b"" + None, + None, + None, + None, + None, + b"", b"" ) ) - def test_ENVELOPE_with_empty_address(self): + def test_ENVELOPE_with_empty_addresses(self): envelope_str = (b'1 (ENVELOPE ( ' b'NIL ' b'"subject" ' b'(("name" NIL "address1" "domain1.com") NIL) ' - b'((NIL NIL "address2" "domain2.com")) ' - b'(("name" NIL "address3" "domain3.com")) ' + b'(NIL (NIL NIL "address2" "domain2.com")) ' + b'(("name" NIL "address3" "domain3.com") NIL ("name" NIL "address3b" "domain3b.com")) ' b'NIL' b'((NIL NIL "address4" "domain4.com") ' b'("person" NIL "address4b" "domain4b.com")) ' @@ -399,7 +404,8 @@ class TestParseFetchResponse(unittest.TestCase): b"subject", (Address(b"name", None, b"address1", b"domain1.com"),), (Address(None, None, b"address2", b"domain2.com"),), - (Address(b"name", None, b"address3", b"domain3.com"),), + (Address(b"name", None, b"address3", b"domain3.com"), + Address(b"name", None, b"address3b", b"domain3b.com")), None, (Address(None, None, b"address4", b"domain4.com"), Address(b"person", None, b"address4b", b"domain4b.com")),