From 39fa6e68fc2afaafc0e8440d212b464d2e20c326 Mon Sep 17 00:00:00 2001 From: mnandri Date: Wed, 16 Dec 2015 18:26:31 +0100 Subject: fixing unit test -- again WIP --- service/pixelated/adapter/services/mail_service.py | 1 + service/pixelated/resources/attachments_resource.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'service/pixelated') diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py index 2f63a2bc..4c1c1c0d 100644 --- a/service/pixelated/adapter/services/mail_service.py +++ b/service/pixelated/adapter/services/mail_service.py @@ -25,6 +25,7 @@ from pixelated.adapter.model.status import Status from pixelated.adapter.services.tag_service import extract_reserved_tags from leap.mail.adaptors.soledad import SoledadMailAdaptor + class MailService(object): def __init__(self, mail_sender, mail_store, search_engine, account_email): diff --git a/service/pixelated/resources/attachments_resource.py b/service/pixelated/resources/attachments_resource.py index 2b5a6912..911fc43d 100644 --- a/service/pixelated/resources/attachments_resource.py +++ b/service/pixelated/resources/attachments_resource.py @@ -87,12 +87,13 @@ class AttachmentsResource(Resource): '' def render_POST(self, request): - fields = cgi.FieldStorage(fp=request.content, headers=request.headers, environ={'REQUEST_METHOD':'POST'}) + fields = cgi.FieldStorage(fp=request.content, headers=(request.getAllHeaders()), + environ={'REQUEST_METHOD': 'POST'}) _file = fields['attachment'] deferred = defer.maybeDeferred(self.mail_service.attachment_id, _file.value, _file.type) def send_location(attachment_id): - request.headers['Location'] = '/%s/%s'% (self.BASE_URL, attachment_id) + request.headers['Location'] = '/%s/%s' % (self.BASE_URL, attachment_id) respond_json_deferred({"attachment_id": attachment_id}, request, status_code=201) def error_handler(error): -- cgit v1.2.3