bamthomas / aioimaplib

Python asyncio IMAP4rev1 client library
GNU General Public License v3.0
138 stars 59 forks source link

Change test_fetch so it doesn't rely on knowing the email's body length #34

Closed aliceh75 closed 6 years ago

aliceh75 commented 6 years ago

The test TestAioimaplib.test_fetch relies on the generated email body being 360 bytes. When I run the tests locally (x86_64, Ubuntu 16.04, Python 3.5) the generated body is 378 bytes.

I don't know where the extra bytes come from - but the generated email looks correct to me. Given that it's not the purpose of test_fetch to check how the email body is generated I've updated the test so it doesn't rely on knowing the body's length.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.002%) to 95.677% when pulling 241258a7522d785cb1671b67c91056bc51c57d5f on aliceh75:fix_tests into 6572fe5346cafc76a7b137e5069290df08ee7194 on bamthomas:master.

aliceh75 commented 6 years ago

If it is of any interest, this is what the email body looks like when I run the tests:

 b'Content-Type: text/plain; charset="utf-8"\nMIME-Version: 1.0\nContent-Transfer-Encoding: base64\nReturn-Path: \nDelivered-To: \nMessage-ID: <93f411d1-1b1a-11e8-9014-a088b429b1dc@mockimap>\nDate: Mon, 26 Feb 2018 17:29:20 +0000\nFrom: \nUser-Agent: python3\nMIME-Version: 1.0\nTo: user\nSubject: =?utf-8?q?hello?=\n\ncGxlYXNlZCB0byBtZWV0IHlvdSwgd29udCB5b3UgZ3Vlc3MgbXkgbmFtZSA/\n'