summaryrefslogtreecommitdiff
path: root/mail/src
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-01-15 15:50:20 -0400
committerKali Kaneko <kali@leap.se>2015-02-11 14:05:43 -0400
commit764e5d546ce613f6363a2ae86c13cec7af01049e (patch)
tree9f07ba7f296ce6c9b0a308de1f9899afc038d942 /mail/src
parentb481d239101e9bd090ffcca547294cf30738d028 (diff)
update mail/imap tests
Diffstat (limited to 'mail/src')
-rw-r--r--mail/src/leap/mail/mail.py6
-rw-r--r--mail/src/leap/mail/tests/test_mail.py18
2 files changed, 11 insertions, 13 deletions
diff --git a/mail/src/leap/mail/mail.py b/mail/src/leap/mail/mail.py
index cb37d255..8629d0e1 100644
--- a/mail/src/leap/mail/mail.py
+++ b/mail/src/leap/mail/mail.py
@@ -285,6 +285,8 @@ class MessageCollection(object):
self.mbox_indexer = mbox_indexer
self.mbox_wrapper = mbox_wrapper
+ # TODO --- review this count shit. I think it's better to patch server
+ # to accept deferreds.
# TODO need to initialize count here because imap server does not
# expect a defered for the count. caller should return the deferred for
# prime_count (ie, initialize) when returning the collection
@@ -295,10 +297,6 @@ class MessageCollection(object):
count = 0
self._count = count
- #def initialize(self):
- #d = self.prime_count()
- #return d
-
def is_mailbox_collection(self):
"""
Return True if this collection represents a Mailbox.
diff --git a/mail/src/leap/mail/tests/test_mail.py b/mail/src/leap/mail/tests/test_mail.py
index 2c4b9195..9bc553f5 100644
--- a/mail/src/leap/mail/tests/test_mail.py
+++ b/mail/src/leap/mail/tests/test_mail.py
@@ -17,8 +17,10 @@
"""
Tests for the mail module.
"""
-import time
import os
+import time
+import uuid
+
from functools import partial
from email.parser import Parser
from email.Utils import formatdate
@@ -28,9 +30,6 @@ from leap.mail.mail import MessageCollection, Account
from leap.mail.mailbox_indexer import MailboxIndexer
from leap.mail.tests.common import SoledadTestMixin
-# from twisted.internet import defer
-from twisted.trial import unittest
-
HERE = os.path.split(os.path.abspath(__file__))[0]
@@ -67,24 +66,26 @@ class CollectionMixin(object):
if mbox_collection:
mbox_indexer = MailboxIndexer(store)
mbox_name = "TestMbox"
+ mbox_uuid = str(uuid.uuid4())
else:
mbox_indexer = mbox_name = None
def get_collection_from_mbox_wrapper(wrapper):
+ wrapper.uuid = mbox_uuid
return MessageCollection(
adaptor, store,
mbox_indexer=mbox_indexer, mbox_wrapper=wrapper)
d = adaptor.initialize_store(store)
if mbox_collection:
- d.addCallback(lambda _: mbox_indexer.create_table(mbox_name))
+ d.addCallback(lambda _: mbox_indexer.create_table(mbox_uuid))
d.addCallback(lambda _: adaptor.get_or_create_mbox(store, mbox_name))
d.addCallback(get_collection_from_mbox_wrapper)
return d
# TODO profile add_msg. Why are these tests so SLOW??!
-class MessageTestCase(unittest.TestCase, SoledadTestMixin, CollectionMixin):
+class MessageTestCase(SoledadTestMixin, CollectionMixin):
"""
Tests for the Message class.
"""
@@ -204,8 +205,7 @@ class MessageTestCase(unittest.TestCase, SoledadTestMixin, CollectionMixin):
self.assertEquals(msg.get_tags(), self.msg_tags)
-class MessageCollectionTestCase(unittest.TestCase,
- SoledadTestMixin, CollectionMixin):
+class MessageCollectionTestCase(SoledadTestMixin, CollectionMixin):
"""
Tests for the MessageCollection class.
"""
@@ -294,7 +294,7 @@ class MessageCollectionTestCase(unittest.TestCase,
pass
-class AccountTestCase(unittest.TestCase, SoledadTestMixin):
+class AccountTestCase(SoledadTestMixin):
"""
Tests for the Account class.
"""