From 4ae8a4bb0dedae1ab5a6b66eea3e1b9598a72e9f Mon Sep 17 00:00:00 2001 From: Folker Bernitt Date: Mon, 10 Aug 2015 10:07:41 +0200 Subject: Fixed test_tags integration test. --- service/pixelated/adapter/services/mail_service.py | 4 ++-- service/test/integration/test_tags.py | 26 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'service') diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py index 1d161958..0c2884ed 100644 --- a/service/pixelated/adapter/services/mail_service.py +++ b/service/pixelated/adapter/services/mail_service.py @@ -53,8 +53,8 @@ class MailService(object): raise ValueError('None of the following words can be used as tags: ' + ' '.join(reserved_words)) new_tags = self._favor_existing_tags_casing(new_tags) mail = yield self.mail(mail_id) - yield mail.update_tags(set(new_tags)) - self.search_engine.index_mail(mail) + mail.tags |= set(new_tags) + yield self.mail_store.update_mail(mail) defer.returnValue(mail) diff --git a/service/test/integration/test_tags.py b/service/test/integration/test_tags.py index 75cb81f6..0e0fe66c 100644 --- a/service/test/integration/test_tags.py +++ b/service/test/integration/test_tags.py @@ -28,8 +28,8 @@ class TagsTest(SoledadTestBase): @defer.inlineCallbacks def test_add_tag_to_an_inbox_mail_and_query(self): - mail = MailBuilder().with_subject('Mail with tags').build_input_mail() - yield self.add_mail_to_inbox(mail) + 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'])) @@ -41,14 +41,14 @@ class TagsTest(SoledadTestBase): @defer.inlineCallbacks def test_use_old_casing_when_same_tag_with_different_casing_is_posted(self): - mail = MailBuilder().with_subject('Mail with tags').build_input_mail() - yield self.add_mail_to_inbox(mail) + 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') self.assertEquals({'ImPoRtAnT'}, set(mails[0].tags)) - another_mail = MailBuilder().with_subject('Mail with tags').build_input_mail() - yield self.add_mail_to_inbox(another_mail) + 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') self.assertEquals(0, len(mails)) @@ -59,8 +59,8 @@ class TagsTest(SoledadTestBase): @defer.inlineCallbacks def test_tags_are_case_sensitive(self): - mail = MailBuilder().with_subject('Mail with tags').build_input_mail() - yield self.add_mail_to_inbox(mail) + 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'])) @@ -75,8 +75,8 @@ class TagsTest(SoledadTestBase): @defer.inlineCallbacks def test_empty_tags_are_not_allowed(self): - mail = MailBuilder().with_subject('Mail with tags').build_input_mail() - yield self.add_mail_to_inbox(mail) + 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(['tag1', ' '])) @@ -86,12 +86,12 @@ class TagsTest(SoledadTestBase): @defer.inlineCallbacks def test_addition_of_reserved_tags_is_not_allowed(self): - mail = MailBuilder().with_subject('Mail with tags').build_input_mail() - yield self.add_mail_to_inbox(mail) + input_mail = MailBuilder().with_subject('Mail with tags').build_input_mail() + mail = yield self.add_mail_to_inbox(input_mail) for tag in SPECIAL_TAGS: response = yield self.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 (yield self.mailboxes.inbox).mail(mail.ident) + mail = yield self.mail_store.get_mail(mail.ident) self.assertNotIn('drafts', mail.tags) -- cgit v1.2.3