diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-07 09:30:51 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-11 17:00:33 +0200 |
commit | 6b588bb4cb93f8e265d044ea784cb18b7021b26c (patch) | |
tree | 01eacc11e8c6bf0a21312cc9b9295f68872130a0 /service/test/unit/adapter | |
parent | 08497951fa9aed8d28be8b2dea1aef2135f56769 (diff) |
Changed test_delete_mail.py integration test to new mail store.
- intermediate state, some tests are broken
Diffstat (limited to 'service/test/unit/adapter')
-rw-r--r-- | service/test/unit/adapter/mailstore/test_leap_mailstore.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/service/test/unit/adapter/mailstore/test_leap_mailstore.py b/service/test/unit/adapter/mailstore/test_leap_mailstore.py index 4565cc6d..429f1683 100644 --- a/service/test/unit/adapter/mailstore/test_leap_mailstore.py +++ b/service/test/unit/adapter/mailstore/test_leap_mailstore.py @@ -23,7 +23,7 @@ from twisted.internet.defer import FirstError from twisted.trial.unittest import TestCase from leap.mail import constants from twisted.internet import defer -from mockito import mock, when, verify, any +from mockito import mock, when, verify, any as ANY import test.support.mockito from leap.mail.adaptors.soledad import SoledadMailAdaptor, MailboxWrapper import pkg_resources @@ -31,7 +31,7 @@ from leap.mail.mail import Message from pixelated.adapter.mailstore import underscore_uuid from pixelated.adapter.mailstore.leap_mailstore import LeapMailStore, LeapMail - +import test.support.mockito class TestLeapMail(TestCase): def test_leap_mail(self): @@ -203,8 +203,9 @@ class TestLeapMailStore(TestCase): def test_add_mailbox(self): when(self.soledad).list_indexes().thenReturn(defer.succeed(MAIL_INDEXES)).thenReturn(defer.succeed(MAIL_INDEXES)) when(self.soledad).get_from_index('by-type-and-mbox', 'mbox', 'TEST').thenReturn(defer.succeed([])) - when(self.soledad).create_doc(any()).thenReturn(defer.succeed(None)) self._mock_create_doc(self.mbox_uuid, MailboxWrapper(mbox='TEST')) + when(self.soledad).get_doc(self.mbox_uuid).thenAnswer(lambda: defer.succeed(self.doc_by_id[self.mbox_uuid])) + when(self.soledad).put_doc(ANY()).thenAnswer(lambda: defer.succeed(None)) store = LeapMailStore(self.soledad) mbox = yield store.add_mailbox('TEST') @@ -212,6 +213,7 @@ class TestLeapMailStore(TestCase): self.assertIsNotNone(mbox) self.assertEqual(self.mbox_uuid, mbox.doc_id) self.assertEqual('TEST', mbox.mbox) + self.assertIsNotNone(mbox.uuid) # assert index got updated @defer.inlineCallbacks |