summaryrefslogtreecommitdiff
path: root/service/test/integration/test_tags.py
diff options
context:
space:
mode:
authorRoald de Vries <rdevries@thoughtworks.com>2016-10-06 17:03:44 -0300
committerRoald de Vries <rdevries@thoughtworks.com>2016-10-07 18:25:02 -0300
commitf4d7541c9b6dcf67b57b13f7ca7434ec68eeb59c (patch)
tree8d50a54a9a8d5dd451253e55275f209f9df32b0a /service/test/integration/test_tags.py
parent4642cee939c08bfa809f55b6a85ffa773600eaf9 (diff)
use test client in test case through composition instead of inheritance
Diffstat (limited to 'service/test/integration/test_tags.py')
-rw-r--r--service/test/integration/test_tags.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/service/test/integration/test_tags.py b/service/test/integration/test_tags.py
index 0e0fe66c..555a7382 100644
--- a/service/test/integration/test_tags.py
+++ b/service/test/integration/test_tags.py
@@ -29,30 +29,30 @@ class TagsTest(SoledadTestBase):
@defer.inlineCallbacks
def test_add_tag_to_an_inbox_mail_and_query(self):
input_mail = MailBuilder().with_subject('Mail with tags').build_input_mail()
- mail = yield self.add_mail_to_inbox(input_mail)
+ mail = yield self.app_test_client.add_mail_to_inbox(input_mail)
- yield self.post_tags(mail.ident, self._tags_json(['IMPORTANT']))
+ yield self.app_test_client.post_tags(mail.ident, self._tags_json(['IMPORTANT']))
- mails = yield self.get_mails_by_tag('inbox')
+ mails = yield self.app_test_client.get_mails_by_tag('inbox')
self.assertEquals({'IMPORTANT'}, set(mails[0].tags))
- mails = yield self.get_mails_by_tag('IMPORTANT')
+ mails = yield self.app_test_client.get_mails_by_tag('IMPORTANT')
self.assertEquals('Mail with tags', mails[0].subject)
@defer.inlineCallbacks
def test_use_old_casing_when_same_tag_with_different_casing_is_posted(self):
input_mail = MailBuilder().with_subject('Mail with tags').build_input_mail()
- mail = yield self.add_mail_to_inbox(input_mail)
- yield self.post_tags(mail.ident, self._tags_json(['ImPoRtAnT']))
- mails = yield self.get_mails_by_tag('ImPoRtAnT')
+ mail = yield self.app_test_client.add_mail_to_inbox(input_mail)
+ yield self.app_test_client.post_tags(mail.ident, self._tags_json(['ImPoRtAnT']))
+ mails = yield self.app_test_client.get_mails_by_tag('ImPoRtAnT')
self.assertEquals({'ImPoRtAnT'}, set(mails[0].tags))
another_input_mail = MailBuilder().with_subject('Mail with tags').build_input_mail()
- another_mail = yield self.add_mail_to_inbox(another_input_mail)
- yield self.post_tags(another_mail.ident, self._tags_json(['IMPORTANT']))
- mails = yield self.get_mails_by_tag('IMPORTANT')
+ another_mail = yield self.app_test_client.add_mail_to_inbox(another_input_mail)
+ yield self.app_test_client.post_tags(another_mail.ident, self._tags_json(['IMPORTANT']))
+ mails = yield self.app_test_client.get_mails_by_tag('IMPORTANT')
self.assertEquals(0, len(mails))
- mails = yield self.get_mails_by_tag('ImPoRtAnT')
+ mails = yield self.app_test_client.get_mails_by_tag('ImPoRtAnT')
self.assertEquals(2, len(mails))
self.assertEquals({'ImPoRtAnT'}, set(mails[0].tags))
self.assertEquals({'ImPoRtAnT'}, set(mails[1].tags))
@@ -60,38 +60,38 @@ class TagsTest(SoledadTestBase):
@defer.inlineCallbacks
def test_tags_are_case_sensitive(self):
input_mail = MailBuilder().with_subject('Mail with tags').build_input_mail()
- mail = yield self.add_mail_to_inbox(input_mail)
+ mail = yield self.app_test_client.add_mail_to_inbox(input_mail)
- yield self.post_tags(mail.ident, self._tags_json(['ImPoRtAnT']))
+ yield self.app_test_client.post_tags(mail.ident, self._tags_json(['ImPoRtAnT']))
- mails = yield self.get_mails_by_tag('important')
+ mails = yield self.app_test_client.get_mails_by_tag('important')
self.assertEquals(0, len(mails))
- mails = yield self.get_mails_by_tag('IMPORTANT')
+ mails = yield self.app_test_client.get_mails_by_tag('IMPORTANT')
self.assertEquals(0, len(mails))
- mails = yield self.get_mails_by_tag('ImPoRtAnT')
+ mails = yield self.app_test_client.get_mails_by_tag('ImPoRtAnT')
self.assertEquals({'ImPoRtAnT'}, set(mails[0].tags))
@defer.inlineCallbacks
def test_empty_tags_are_not_allowed(self):
input_mail = MailBuilder().with_subject('Mail with tags').build_input_mail()
- mail = yield self.add_mail_to_inbox(input_mail)
+ mail = yield self.app_test_client.add_mail_to_inbox(input_mail)
- yield self.post_tags(mail.ident, self._tags_json(['tag1', ' ']))
+ yield self.app_test_client.post_tags(mail.ident, self._tags_json(['tag1', ' ']))
- mail = yield self.get_mail(mail.ident)
+ mail = yield self.app_test_client.get_mail(mail.ident)
self.assertEquals(mail['tags'], ['tag1'])
@defer.inlineCallbacks
def test_addition_of_reserved_tags_is_not_allowed(self):
input_mail = MailBuilder().with_subject('Mail with tags').build_input_mail()
- mail = yield self.add_mail_to_inbox(input_mail)
+ mail = yield self.app_test_client.add_mail_to_inbox(input_mail)
for tag in SPECIAL_TAGS:
- response = yield self.post_tags(mail.ident, self._tags_json([tag.name.upper()]))
+ response = yield self.app_test_client.post_tags(mail.ident, self._tags_json([tag.name.upper()]))
self.assertEquals("None of the following words can be used as tags: %s" % tag.name, response)
- mail = yield self.mail_store.get_mail(mail.ident)
+ mail = yield self.app_test_client.mail_store.get_mail(mail.ident)
self.assertNotIn('drafts', mail.tags)