summaryrefslogtreecommitdiff
path: root/py-fake-service
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-08-12 16:49:49 -0300
committerDuda Dornelles <ddornell@thoughtworks.com>2014-08-12 18:50:21 -0300
commit8e0c0485e7c0fd1076291e1a07397726b46ab66e (patch)
tree4a5159e63d4ab73289b05ffc38bf900e4293ab68 /py-fake-service
parentbf7b6aa193188c95c50cbc9d24f4be56afa6dc6f (diff)
saving drafts in py-fake-service;
Diffstat (limited to 'py-fake-service')
-rw-r--r--py-fake-service/app/adapter/mail_service.py4
-rw-r--r--py-fake-service/app/pixelated_user_agent.py4
2 files changed, 7 insertions, 1 deletions
diff --git a/py-fake-service/app/adapter/mail_service.py b/py-fake-service/app/adapter/mail_service.py
index 3d12feb5..815d3dc4 100644
--- a/py-fake-service/app/adapter/mail_service.py
+++ b/py-fake-service/app/adapter/mail_service.py
@@ -73,6 +73,10 @@ class MailService:
return mail.ident
+ def update_draft(self, mail):
+ mail = Mail.from_json(mail)
+ self.mailset.update(mail)
+ return mail.ident
diff --git a/py-fake-service/app/pixelated_user_agent.py b/py-fake-service/app/pixelated_user_agent.py
index e0312114..2abdb5a1 100644
--- a/py-fake-service/app/pixelated_user_agent.py
+++ b/py-fake-service/app/pixelated_user_agent.py
@@ -36,7 +36,9 @@ def save_draft_or_send():
@app.route('/mails', methods=['PUT'])
def update_draft():
- return respond_json({'ident': 123})
+ mail = request.json
+ ident = mail_service.update_draft(mail)
+ return respond_json({'ident': ident})
@app.route('/mails')