summaryrefslogtreecommitdiff
path: root/py-fake-service/app/adapter
diff options
context:
space:
mode:
Diffstat (limited to 'py-fake-service/app/adapter')
-rw-r--r--py-fake-service/app/adapter/mail.py4
-rw-r--r--py-fake-service/app/adapter/mail_service.py3
-rw-r--r--py-fake-service/app/adapter/mailset.py7
3 files changed, 11 insertions, 3 deletions
diff --git a/py-fake-service/app/adapter/mail.py b/py-fake-service/app/adapter/mail.py
index 242501c8..8116129d 100644
--- a/py-fake-service/app/adapter/mail.py
+++ b/py-fake-service/app/adapter/mail.py
@@ -10,11 +10,12 @@ class Mail:
mail = Mail()
mail.header = mail_json['header']
mail.header['date'] = datetime.now().isoformat()
- mail.ident = mail_json['ident'] or 0
+ mail.ident = mail_json.get('ident', 0)
mail.body = mail_json['body']
mail.tags = mail_json['tags']
mail.security_casing = {}
mail.status = []
+ mail.draft_reply_for = mail_json.get('draft_reply_for', 0)
return mail
@@ -26,6 +27,7 @@ class Mail:
self.tags = self._get_tags(mbox_mail)
self.security_casing = {}
self.status = self._get_status()
+ self.draft_reply_for = -1
def _get_status(self):
status = []
diff --git a/py-fake-service/app/adapter/mail_service.py b/py-fake-service/app/adapter/mail_service.py
index 815d3dc4..7c2570f9 100644
--- a/py-fake-service/app/adapter/mail_service.py
+++ b/py-fake-service/app/adapter/mail_service.py
@@ -78,5 +78,6 @@ class MailService:
self.mailset.update(mail)
return mail.ident
-
+ def draft_reply_for(self, mail_id):
+ return self.mailset.find(draft_reply_for=mail_id)
diff --git a/py-fake-service/app/adapter/mailset.py b/py-fake-service/app/adapter/mailset.py
index b59959a7..0b55bdc2 100644
--- a/py-fake-service/app/adapter/mailset.py
+++ b/py-fake-service/app/adapter/mailset.py
@@ -39,4 +39,9 @@ class MailSet:
self.ident += 1
return mail
-
+ def find(self, draft_reply_for):
+ match = [mail for mail in self.mails.values() if mail.draft_reply_for ==draft_reply_for]
+ if len(match) == 0:
+ return None
+ else:
+ return match[0]