Closed mmartin closed 4 years ago
Would you mind adding a test case similar to 6bb18fa97c78b3cb1fcb60ce5d850602b55e358f for this?
Something like this?
@mock.patch('alot.db.utils.settings.mailcap_find_match',
mock.Mock(return_value=(None, {'view': 'cat "%s"'})))
def test_plaintext_mailcap_wo_content_type(self):
mailstring = '\n'.join([
'From: me@localhost'
'To: you@localhost'
'Subject: test subject'
'\n'
'test body'])
mail = email.message_from_string(mailstring,
_class=email.message.EmailMessage)
body_part = utils.get_body_part(mail)
actual = utils.extract_body_part(body_part)
expected = 'test body'
self.assertEqual(actual, expected)
Yes that looks great. Perhaps put the mail string into a separate file under tests/static/mail
or simply re-use one of the mails already in that corpus?
It'd great if you could send a PR with this test and your proposed patch (with an explanation why the extra empty list parameter fixes the issue).
Thanks for making alot better :)
Describe the bug After b1c93c4d0c1eeacd64a195f16861bcb73910e739 I'm no longer able to open e-mails without
Content-Type
header.Software Versions
To Reproduce Steps to reproduce the behaviour:
Content-Type
header;Error Log
Additional info https://github.com/pazz/alot/blob/dff3ae0e46719c8261ba819d71734c5591988694/alot/db/utils.py#L368
get_params()
returnsNone
, if the e-mail doesn't haveContent-Type
header.Proposed patch: