summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/integration/__init__.py9
-rw-r--r--service/integration/mark_as_read_test.py38
2 files changed, 46 insertions, 1 deletions
diff --git a/service/integration/__init__.py b/service/integration/__init__.py
index a9991f6f..7691447d 100644
--- a/service/integration/__init__.py
+++ b/service/integration/__init__.py
@@ -144,6 +144,9 @@ class SoledadTestBase:
def delete_mail(self, mail_ident):
self.app.delete('/mail/' + mail_ident)
+ def mark_as_read(self, mail_ident):
+ self.app.post('/mail/' + mail_ident + '/read', content_type="application/json")
+
class ResponseMail:
@@ -164,4 +167,8 @@ class ResponseMail:
@property
def tags(self):
- return self.mail_dict['tags'] \ No newline at end of file
+ return self.mail_dict['tags']
+
+ @property
+ def status(self):
+ return self.mail_dict['status'] \ No newline at end of file
diff --git a/service/integration/mark_as_read_test.py b/service/integration/mark_as_read_test.py
new file mode 100644
index 00000000..60084efa
--- /dev/null
+++ b/service/integration/mark_as_read_test.py
@@ -0,0 +1,38 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+import unittest
+from integration import MailBuilder, SoledadTestBase
+
+
+class MarkAsReadTest(unittest.TestCase, SoledadTestBase):
+
+ def setUp(self):
+ self.setup_soledad()
+
+ def tearDown(self):
+ self.teardown_soledad()
+
+ def test_mark_as_read(self):
+ input_mail = MailBuilder().build_input_mail()
+ self.pixelated_mailboxes.inbox().add(input_mail)
+
+ mails = self.get_mails_by_tag('inbox')
+ self.assertFalse('read' in mails[0].status)
+
+ self.mark_as_read(input_mail.ident)
+
+ mails = self.get_mails_by_tag('inbox')
+ self.assertTrue('read' in mails[0].status)