Skip to content

Commit

Permalink
Make content-id attribute name more explicit (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-w authored Jan 6, 2019
1 parent 5f3b036 commit 9b3b117
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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"}]
}
-----------------
Expand Down
2 changes: 1 addition & 1 deletion opwen_email_server/utils/email_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
6 changes: 3 additions & 3 deletions tests/opwen_email_server/utils/test_email_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 9b3b117

Please sign in to comment.