summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorNavaL <mnandri@thoughtworks.com>2016-01-07 15:39:34 +0100
committerNavaL <mnandri@thoughtworks.com>2016-01-11 16:56:29 +0100
commite10e43968e2a4a8ef3ef84fd7ff7e741af5e40b0 (patch)
tree1275f5e88dc13baf035fe96b94158ab3258901cb /service
parent0e39a9a95ba273545950c5db7f92132dd8b95395 (diff)
renamed attachment_id attribute to ident on POST response, to conform with the GET attachment API
Issue #548
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/resources/attachments_resource.py2
-rw-r--r--service/pixelated/resources/mails_resource.py2
-rw-r--r--service/test/integration/test_retrieve_attachment.py2
-rw-r--r--service/test/unit/resources/test_attachments_resource.py2
-rw-r--r--service/test/unit/resources/test_mails_resource.py8
5 files changed, 8 insertions, 8 deletions
diff --git a/service/pixelated/resources/attachments_resource.py b/service/pixelated/resources/attachments_resource.py
index e7bb6bdb..51fcdd3e 100644
--- a/service/pixelated/resources/attachments_resource.py
+++ b/service/pixelated/resources/attachments_resource.py
@@ -87,7 +87,7 @@ class AttachmentsResource(Resource):
def send_location(attachment_id):
request.headers['Location'] = '/%s/%s' % (self.BASE_URL, attachment_id)
- response_json = {"attachment_id": attachment_id,
+ response_json = {"ident": attachment_id,
"content-type": _file.type,
"filename": _file.filename,
"filesize": len(_file.value)}
diff --git a/service/pixelated/resources/mails_resource.py b/service/pixelated/resources/mails_resource.py
index f9397263..3a5b6286 100644
--- a/service/pixelated/resources/mails_resource.py
+++ b/service/pixelated/resources/mails_resource.py
@@ -180,7 +180,7 @@ class MailsResource(Resource):
def _fetch_attachment_contents(self, content_dict):
attachments = content_dict.get('attachments', []) if content_dict else []
for attachment in attachments:
- retrieved_attachment = yield self._mail_service.attachment(attachment['attachment_id'])
+ retrieved_attachment = yield self._mail_service.attachment(attachment['ident'])
attachment['raw'] = retrieved_attachment['content']
content_dict['attachments'] = attachments
defer.returnValue(content_dict)
diff --git a/service/test/integration/test_retrieve_attachment.py b/service/test/integration/test_retrieve_attachment.py
index 0998e688..acb23409 100644
--- a/service/test/integration/test_retrieve_attachment.py
+++ b/service/test/integration/test_retrieve_attachment.py
@@ -67,7 +67,7 @@ class RetrieveAttachmentTest(SoledadTestBase):
self.assertEqual(201, req.code)
self.assertEqual('/attachment/B5B4ED80AC3B894523D72E375DACAA2FC6606C18EDF680FE95903086C8B5E14A', req.headers['Location'])
- response_json = {'attachment_id': 'B5B4ED80AC3B894523D72E375DACAA2FC6606C18EDF680FE95903086C8B5E14A',
+ response_json = {'ident': 'B5B4ED80AC3B894523D72E375DACAA2FC6606C18EDF680FE95903086C8B5E14A',
'content-type': content_type,
'filename': filename,
'filesize': len(data)}
diff --git a/service/test/unit/resources/test_attachments_resource.py b/service/test/unit/resources/test_attachments_resource.py
index d536144f..b12d9e4b 100644
--- a/service/test/unit/resources/test_attachments_resource.py
+++ b/service/test/unit/resources/test_attachments_resource.py
@@ -36,7 +36,7 @@ class AttachmentsResourceTest(unittest.TestCase):
def assert_response(_):
self.assertEqual(201, request.code)
self.assertEqual('/attachment/%s' % attachment_id, request.headers['Location'])
- response_json = {'attachment_id': attachment_id, 'content-type': 'some mocked type',
+ response_json = {'ident': attachment_id, 'content-type': 'some mocked type',
'filename': 'filename.txt', 'filesize': 17}
self.assertEqual(response_json, json.loads(request.written[0]))
verify(self.mail_service).save_attachment('some mocked value', 'some mocked type')
diff --git a/service/test/unit/resources/test_mails_resource.py b/service/test/unit/resources/test_mails_resource.py
index 352bd272..efa37b27 100644
--- a/service/test/unit/resources/test_mails_resource.py
+++ b/service/test/unit/resources/test_mails_resource.py
@@ -56,7 +56,7 @@ class TestMailsResource(unittest.TestCase):
request = DummyRequest(['/mails'])
request.method = 'PUT'
content = mock()
- when(content).read().thenReturn('{"attachments": [{"attachment_id": "some fake attachment id"}]}')
+ when(content).read().thenReturn('{"attachments": [{"ident": "some fake attachment id"}]}')
when(self.mail_service).attachment('some fake attachment id').thenReturn(defer.Deferred())
request.content = content
@@ -76,11 +76,11 @@ class TestMailsResource(unittest.TestCase):
request = DummyRequest(['/mails'])
request.method = 'POST'
content = mock()
- when(content).read().thenReturn('{"attachments": [{"attachment_id": "some fake attachment id"}]}')
+ when(content).read().thenReturn('{"attachments": [{"ident": "some fake attachment id"}]}')
when(self.mail_service).attachment('some fake attachment id').thenReturn(defer.succeed({"content": "some content"}))
as_dictable = mock()
when(as_dictable).as_dict().thenReturn({})
- when(self.mail_service).send_mail({"attachments": [{"attachment_id": "some fake attachment id", "raw": "some content"}]})\
+ when(self.mail_service).send_mail({"attachments": [{"ident": "some fake attachment id", "raw": "some content"}]})\
.thenReturn(defer.succeed(as_dictable))
request.content = content
@@ -91,7 +91,7 @@ class TestMailsResource(unittest.TestCase):
def assert_response(_):
verify(self.mail_service).attachment('some fake attachment id')
- verify(self.mail_service).send_mail({"attachments": [{"attachment_id": "some fake attachment id", "raw": "some content"}]})
+ verify(self.mail_service).send_mail({"attachments": [{"ident": "some fake attachment id", "raw": "some content"}]})
d.addCallback(assert_response)
return d