summaryrefslogtreecommitdiff
path: root/service/test/unit/adapter
diff options
context:
space:
mode:
authorNavaL <mnandri@thoughtworks.com>2016-01-07 18:12:50 +0100
committerNavaL <mnandri@thoughtworks.com>2016-01-11 16:56:29 +0100
commitf07aa46453a311010dad3218689891f91f76e3fc (patch)
treef17a21831c3d54ce629adfaf5ac7b55e5c1d7725 /service/test/unit/adapter
parente10e43968e2a4a8ef3ef84fd7ff7e741af5e40b0 (diff)
matching POST response and GET of an attachment -- API specification
Issue #548
Diffstat (limited to 'service/test/unit/adapter')
-rw-r--r--service/test/unit/adapter/mailstore/test_leap_mail.py6
-rw-r--r--service/test/unit/adapter/mailstore/test_leap_mailstore.py6
2 files changed, 7 insertions, 5 deletions
diff --git a/service/test/unit/adapter/mailstore/test_leap_mail.py b/service/test/unit/adapter/mailstore/test_leap_mail.py
index 3f117dbe..f883dad1 100644
--- a/service/test/unit/adapter/mailstore/test_leap_mail.py
+++ b/service/test/unit/adapter/mailstore/test_leap_mail.py
@@ -85,9 +85,11 @@ class TestLeapMail(TestCase):
self.assertEqual(body, mail.as_dict()['body'])
def test_as_dict_with_attachments(self):
- mail = LeapMail('doc id', 'INBOX', attachments=[AttachmentInfo('id', 'name', 'encoding')])
+ mail = LeapMail('doc id', 'INBOX', attachments=[AttachmentInfo({'phash': 'id', 'ctype': 'text/plain'},
+ {'Content-Description': 'name',
+ 'Content-Transfer-Encoding': 'encoding', 'size': 2})])
- self.assertEqual([{'ident': 'id', 'name': 'name', 'encoding': 'encoding'}],
+ self.assertEqual([{'ident': 'id', 'name': 'name', 'encoding': 'encoding', 'content-type': 'text/plain', 'size': 2}],
mail.as_dict()['attachments'])
def test_as_dict_headers_with_special_chars(self):
diff --git a/service/test/unit/adapter/mailstore/test_leap_mailstore.py b/service/test/unit/adapter/mailstore/test_leap_mailstore.py
index f4fa367f..090c6b06 100644
--- a/service/test/unit/adapter/mailstore/test_leap_mailstore.py
+++ b/service/test/unit/adapter/mailstore/test_leap_mailstore.py
@@ -238,7 +238,7 @@ class TestLeapMailStore(TestCase):
message = yield store.add_mail('INBOX', input_mail.as_string())
- expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'filename.txt', 'encoding': 'base64'}]
+ expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'filename.txt', 'encoding': 'base64', 'size': 0, 'content-type': 'application/octet-stream'}]
self.assertEqual(expected, message.as_dict()['attachments'])
@defer.inlineCallbacks
@@ -253,7 +253,7 @@ class TestLeapMailStore(TestCase):
message = yield store.add_mail('INBOX', input_mail.as_string())
- expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'super_nice_photo.jpg', 'encoding': 'base64'}]
+ expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'super_nice_photo.jpg', 'encoding': 'base64', 'size': 0, 'content-type': 'application/octet-stream'}]
self.assertEqual(expected, message.as_dict()['attachments'])
@defer.inlineCallbacks
@@ -270,7 +270,7 @@ class TestLeapMailStore(TestCase):
message = yield store.add_mail('INBOX', input_mail.as_string())
- expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'filename.txt', 'encoding': 'base64'}]
+ expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'filename.txt', 'encoding': 'base64', 'size': 0, 'content-type': 'application/octet-stream'}]
self.assertEqual(expected, message.as_dict()['attachments'])
def test_extract_attachment_filename_with_or_without_quotes(self):