From 338498cef1cd4f2b9ae49bc54bd496de0e5472a0 Mon Sep 17 00:00:00 2001 From: mnandri Date: Wed, 16 Dec 2015 16:35:33 +0100 Subject: WIP: rename me later --- service/test/support/integration/app_test_client.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'service/test/support/integration/app_test_client.py') diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py index 484bea6e..5f7eb90a 100644 --- a/service/test/support/integration/app_test_client.py +++ b/service/test/support/integration/app_test_client.py @@ -123,8 +123,9 @@ class AppTestClient(object): request.args = get_args return self._render(request, as_json) - def post(self, path, body=''): - request = request_mock(path=path, method="POST", body=body, headers={'Content-Type': ['application/json']}) + def post(self, path, body='', headers=None): + headers = headers or {'Content-Type': 'application/json'} + request = request_mock(path=path, method="POST", body=body, headers=headers) return self._render(request) def put(self, path, body): @@ -198,6 +199,12 @@ class AppTestClient(object): res = yield deferred_result defer.returnValue((res, req)) + @defer.inlineCallbacks + def post_attachment(self, data, headers): + deferred_result, req = self.post('/attachment', body=data, headers=headers) + res = yield deferred_result + defer.returnValue((res, req)) + def put_mail(self, data): res, req = self.put('/mails', data) return res, req -- cgit v1.2.3