summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2017-05-24 14:25:19 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2017-05-24 14:59:55 +0200
commitcf610930f7a9b56b0378920bfdd4263f490b5cb3 (patch)
treec6afdc78a8d07fd5d32de6482ef186fa8436f74a /tests
parent37b25fd88400df8cc726470b5d897111f2373b96 (diff)
[tests] fix tests
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/mail/adaptors/test_soledad_adaptor.py6
-rw-r--r--tests/integration/mail/imap/test_imap.py23
-rw-r--r--tests/integration/mail/test_mail.py15
3 files changed, 25 insertions, 19 deletions
diff --git a/tests/integration/mail/adaptors/test_soledad_adaptor.py b/tests/integration/mail/adaptors/test_soledad_adaptor.py
index 72b0be8..14e0e40 100644
--- a/tests/integration/mail/adaptors/test_soledad_adaptor.py
+++ b/tests/integration/mail/adaptors/test_soledad_adaptor.py
@@ -396,9 +396,9 @@ class SoledadMailAdaptorTestCase(SoledadTestMixin):
msg = adaptor.get_msg_from_string(MessageClass, raw)
def check_create_result(created):
- # that's one mdoc, one hdoc, one fdoc, one cdoc
- self.assertEqual(len(created), 4)
- for doc in created:
+ # that's the wrapper
+ self.assertEqual(created.__class__.__name__, 'MessageWrapper')
+ for doc in [created.mdoc, created.fdoc, created.hdoc]:
self.assertTrue(
doc.__class__.__name__,
"SoledadDocument")
diff --git a/tests/integration/mail/imap/test_imap.py b/tests/integration/mail/imap/test_imap.py
index 6f8eec2..ea86125 100644
--- a/tests/integration/mail/imap/test_imap.py
+++ b/tests/integration/mail/imap/test_imap.py
@@ -81,6 +81,9 @@ class TestRealm:
# DelayedCall.debug = True
+DEFAULT_MBOXES = ['INBOX', 'Sent']
+
+
class LEAPIMAP4ServerTestCase(IMAP4HelperMixin):
"""
@@ -138,8 +141,8 @@ class LEAPIMAP4ServerTestCase(IMAP4HelperMixin):
def _cbTestCreate(self, mailboxes, succeed, fail):
self.assertEqual(self.result, [1] * len(succeed) + [0] * len(fail))
- answers = ([u'INBOX', u'testbox', u'test/box', u'test',
- u'test/box/box', 'foobox'])
+ answers = (DEFAULT_MBOXES + [u'testbox', u'test/box', u'test',
+ u'test/box/box', 'foobox'])
self.assertEqual(sorted(mailboxes), sorted([a for a in answers]))
def testDelete(self):
@@ -165,7 +168,7 @@ class LEAPIMAP4ServerTestCase(IMAP4HelperMixin):
d = defer.gatherResults([d1, d2])
d.addCallback(lambda _: acc.list_all_mailbox_names())
d.addCallback(lambda mboxes: self.assertEqual(
- mboxes, ['INBOX']))
+ set(mboxes), set(DEFAULT_MBOXES)))
return d
def testIllegalInboxDelete(self):
@@ -288,7 +291,8 @@ class LEAPIMAP4ServerTestCase(IMAP4HelperMixin):
d.addCallback(lambda _:
self.server.theAccount.account.list_all_mailbox_names())
d.addCallback(lambda mboxes:
- self.assertItemsEqual(mboxes, ['INBOX', 'newname']))
+ self.assertItemsEqual(
+ mboxes, DEFAULT_MBOXES + ['newname']))
return d
def testIllegalInboxRename(self):
@@ -345,7 +349,7 @@ class LEAPIMAP4ServerTestCase(IMAP4HelperMixin):
return d.addCallback(self._cbTestHierarchicalRename)
def _cbTestHierarchicalRename(self, mailboxes):
- expected = ['INBOX', 'newname/m1', 'newname/m2']
+ expected = DEFAULT_MBOXES + ['newname/m1', 'newname/m2']
self.assertEqual(sorted(mailboxes), sorted([s for s in expected]))
def testSubscribe(self):
@@ -1002,14 +1006,11 @@ class LEAPIMAP4ServerTestCase(IMAP4HelperMixin):
def add_messages():
d = self.mailbox.addMessage(
- 'test 1', flags=('\\Deleted', 'AnotherFlag'),
- notify_just_mdoc=False)
+ 'test 1', flags=('\\Deleted', 'AnotherFlag'))
d.addCallback(lambda _: self.mailbox.addMessage(
- 'test 2', flags=('AnotherFlag',),
- notify_just_mdoc=False))
+ 'test 2', flags=('AnotherFlag',)))
d.addCallback(lambda _: self.mailbox.addMessage(
- 'test 3', flags=('\\Deleted',),
- notify_just_mdoc=False))
+ 'test 3', flags=('\\Deleted',)))
return d
def expunge():
diff --git a/tests/integration/mail/test_mail.py b/tests/integration/mail/test_mail.py
index 637340d..42b4478 100644
--- a/tests/integration/mail/test_mail.py
+++ b/tests/integration/mail/test_mail.py
@@ -313,6 +313,9 @@ class MessageCollectionTestCase(SoledadTestMixin, CollectionMixin):
pass
+DEFAULT_MBOXES = ['INBOX', 'Sent']
+
+
class AccountTestCase(SoledadTestMixin):
"""
Tests for the Account class.
@@ -329,12 +332,13 @@ class AccountTestCase(SoledadTestMixin):
return d
def _test_add_mailbox_cb(self, mboxes):
- expected = ['INBOX', 'TestMailbox']
+ expected = DEFAULT_MBOXES + ['TestMailbox']
self.assertItemsEqual(mboxes, expected)
def test_delete_mailbox(self):
acc = self.get_account('some_user_id')
- d = acc.callWhenReady(lambda _: acc.delete_mailbox("Inbox"))
+ d = acc.callWhenReady(lambda _: acc.delete_mailbox('Inbox'))
+ d.addCallback(lambda _: acc.delete_mailbox('Sent'))
d.addCallback(lambda _: acc.list_all_mailbox_names())
d.addCallback(self._test_delete_mailbox_cb)
return d
@@ -353,7 +357,7 @@ class AccountTestCase(SoledadTestMixin):
return d
def _test_rename_mailbox_cb(self, mboxes):
- expected = ['INBOX', 'RenamedMailbox']
+ expected = DEFAULT_MBOXES + ['RenamedMailbox']
self.assertItemsEqual(mboxes, expected)
def test_get_all_mailboxes(self):
@@ -368,8 +372,9 @@ class AccountTestCase(SoledadTestMixin):
return d
def _test_get_all_mailboxes_cb(self, mailboxes):
- expected = ["INBOX", "OneMailbox", "TwoMailbox", "ThreeMailbox",
- "anotherthing", "anotherthing2"]
+ expected = DEFAULT_MBOXES + [
+ "OneMailbox", "TwoMailbox", "ThreeMailbox", "anotherthing",
+ "anotherthing2"]
names = [m.mbox for m in mailboxes]
self.assertItemsEqual(names, expected)