summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/pixelated/adapter/mail.py27
-rw-r--r--service/test/unit/controllers/mails_controller_test.py2
2 files changed, 14 insertions, 15 deletions
diff --git a/service/pixelated/adapter/mail.py b/service/pixelated/adapter/mail.py
index eedc8242..472bdad4 100644
--- a/service/pixelated/adapter/mail.py
+++ b/service/pixelated/adapter/mail.py
@@ -25,8 +25,7 @@ from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from pycryptopp.hash import sha256
-
-class Mail:
+class Mail(object):
@property
def to(self):
return self.headers['To']
@@ -73,18 +72,6 @@ class Mail:
def _get_chash(self):
return sha256.SHA256(self.raw).hexdigest()
- def as_dict(self):
- return {
- 'header': {k.lower(): v for k, v in self.headers.items()},
- 'ident': self.ident,
- 'tags': list(self.tags),
- 'status': list(self.status),
- 'security_casing': self.security_casing,
- 'body': self.body,
- 'mailbox': self.mailbox_name.lower(),
- 'attachments': self.parts['attachments'] if self.parts else []
- }
-
class InputMail(Mail):
FROM_EMAIL_ADDRESS = None
@@ -319,3 +306,15 @@ class PixelatedMail(Mail):
@property
def encrypted(self):
return self.hdoc.content["headers"].get("OpenPGP", None) is not None
+
+ def as_dict(self):
+ return {
+ 'header': {k.lower(): v for k, v in self.headers.items()},
+ 'ident': self.ident,
+ 'tags': list(self.tags),
+ 'status': list(self.status),
+ 'security_casing': self.security_casing,
+ 'body': self.body,
+ 'mailbox': self.mailbox_name.lower(),
+ 'attachments': self.parts['attachments'] if self.parts else []
+ }
diff --git a/service/test/unit/controllers/mails_controller_test.py b/service/test/unit/controllers/mails_controller_test.py
index 93748de9..6d566c83 100644
--- a/service/test/unit/controllers/mails_controller_test.py
+++ b/service/test/unit/controllers/mails_controller_test.py
@@ -115,7 +115,7 @@ class TestMailsController(unittest.TestCase):
def _successfuly_send_mail(self, ident, mail):
sent_mail = mock()
- mail.mailbox_name = 'TRASH'
+ sent_mail.mailbox_name = 'TRASH'
sent_mail.as_dict = lambda: self.input_mail.json
return sent_mail