summaryrefslogtreecommitdiff
path: root/service/test/unit/adapter
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2015-09-10 19:51:16 -0300
committerVictor Shyba <victor.shyba@gmail.com>2015-09-10 19:51:16 -0300
commit660777bb8fee20bbbe4bb07cbc6679a11c29b7c3 (patch)
tree1caf26f20c18811946731c469ce35008f9001eb2 /service/test/unit/adapter
parent17d9e68acdbe3cf5869fce6a321a027276328d1e (diff)
[test] leap_mailstore handles unknow uuid as empty
Given a unknown mailbox uuid, we should return an empty string as name. This will show the mail as in 'all mails' instead of a KeyError. This scenario is supposed to happen only if the mail comes before the mailbox, which is our current unicorn. Anyway, when the missing mailbox gets created it will read correctly or let the see under all mails instead of breaking the account. --Issue #444
Diffstat (limited to 'service/test/unit/adapter')
-rw-r--r--service/test/unit/adapter/mailstore/test_leap_mailstore.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/service/test/unit/adapter/mailstore/test_leap_mailstore.py b/service/test/unit/adapter/mailstore/test_leap_mailstore.py
index 96a862be..4eabc144 100644
--- a/service/test/unit/adapter/mailstore/test_leap_mailstore.py
+++ b/service/test/unit/adapter/mailstore/test_leap_mailstore.py
@@ -240,6 +240,19 @@ class TestLeapMailStore(TestCase):
self.assertEqual({'INBOX', 'OTHER'}, names)
@defer.inlineCallbacks
+ def test_handles_unmapped_mailbox_uuid(self):
+ # given
+ store = LeapMailStore(self.soledad)
+ new_uuid = 'UNICORN'
+
+ # if no mailbox doc is created yet (async hell?)
+ when(self.soledad).get_from_index('by-type', 'mbox').thenReturn(defer.succeed([]))
+
+ # then it should point to empty, which is all mails
+ name = yield store._mailbox_name_from_uuid(new_uuid)
+ self.assertEquals('', name)
+
+ @defer.inlineCallbacks
def test_add_mail(self):
expected_message = self._add_create_mail_mocks_to_soledad_from_fixture_file('mbox00000000')
mail = self._load_mail_from_file('mbox00000000')