summaryrefslogtreecommitdiff
path: root/service/pixelated/adapter/pixelated_mailboxes.py
diff options
context:
space:
mode:
authorPatrick Maia <pmaia@thoughtworks.com>2014-09-17 02:02:28 -0300
committerPatrick Maia <pmaia@thoughtworks.com>2014-09-17 13:53:25 -0300
commit95b0e2e6f834804630bf9d091b156ac68ff20583 (patch)
tree9bff8ebac2134cf23fd2bcd92f1a9500d8dd5ebf /service/pixelated/adapter/pixelated_mailboxes.py
parentc272f64293bb0157eb7eb1ebba899935f8ed2c3a (diff)
74 - moves move_to_trash logic to PixelatedMailboxes and adds some tests
Diffstat (limited to 'service/pixelated/adapter/pixelated_mailboxes.py')
-rw-r--r--service/pixelated/adapter/pixelated_mailboxes.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/service/pixelated/adapter/pixelated_mailboxes.py b/service/pixelated/adapter/pixelated_mailboxes.py
index b5cac602..aa9015e5 100644
--- a/service/pixelated/adapter/pixelated_mailboxes.py
+++ b/service/pixelated/adapter/pixelated_mailboxes.py
@@ -7,6 +7,7 @@ class PixelatedMailBoxes():
self.account = account
def _create_or_get(self, mailbox_name):
+ mailbox_name = mailbox_name.upper()
if mailbox_name not in self.account.mailboxes:
self.account.addMailbox(mailbox_name)
return PixelatedMailbox.create(self.account, mailbox_name)
@@ -35,11 +36,15 @@ class PixelatedMailBoxes():
mail.set_ident(drafts.mailbox_name, draft_id)
return mail
+ def move_to_trash(self, mail):
+ mail.remove_all_tags()
+ origin_mailbox = mail.mailbox_name
+
+ self._create_or_get(origin_mailbox).remove(mail)
+ return self.trash().add(mail)
+
def mail(self, mail_id):
for mailbox in self.mailboxes:
mail = mailbox.mail(mail_id)
if mail:
return mail
-
- def mailbox_exists(self, name):
- return name.upper() in map(lambda x: x.upper(), self.account.mailboxes)