From 9b3b117c257f580e28f0c776a2ba7a212633e09b Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Sun, 6 Jan 2019 00:36:03 -0500 Subject: [PATCH] Make content-id attribute name more explicit (#123) --- README.rst | 2 +- opwen_email_server/utils/email_parser.py | 2 +- tests/opwen_email_server/utils/test_email_parser.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 2a0e8c2d..ee292438 100644 --- a/README.rst +++ b/README.rst @@ -58,7 +58,7 @@ describes an email, using the following schema: "from": "email", "subject": "string", "body": "html", - "attachments": [{"filename": "string", "content": "base64", "id": "string"}] + "attachments": [{"filename": "string", "content": "base64", "cid": "string"}] } ----------------- diff --git a/opwen_email_server/utils/email_parser.py b/opwen_email_server/utils/email_parser.py index dc66f21d..79d9477b 100644 --- a/opwen_email_server/utils/email_parser.py +++ b/opwen_email_server/utils/email_parser.py @@ -45,7 +45,7 @@ def _parse_attachments(mailparts: Iterable[MailPart]) -> Iterable[dict]: if filename and payload: attachment = {'filename': filename, 'content': payload} if attachment_id: - attachment['id'] = attachment_id + attachment['cid'] = attachment_id yield attachment diff --git a/tests/opwen_email_server/utils/test_email_parser.py b/tests/opwen_email_server/utils/test_email_parser.py index f5171040..c3b283ff 100644 --- a/tests/opwen_email_server/utils/test_email_parser.py +++ b/tests/opwen_email_server/utils/test_email_parser.py @@ -75,9 +75,9 @@ def test_cid(self): attachments = email.get('attachments', []) self.assertEqual(len(attachments), 2) - self.assertIsNotNone(attachments[0].get('id')) - self.assertIsNotNone(attachments[1].get('id')) - self.assertNotEqual(attachments[0]['id'], attachments[1]['id']) + self.assertIsNotNone(attachments[0].get('cid')) + self.assertIsNotNone(attachments[1].get('cid')) + self.assertNotEqual(attachments[0]['cid'], attachments[1]['cid']) @classmethod def _given_mime_email(cls, filename, directory=TEST_DATA_DIRECTORY):