summaryrefslogtreecommitdiff
path: root/service/test/support/integration/soledad_test_base.py
diff options
context:
space:
mode:
authorRoald de Vries <rdevries@thoughtworks.com>2016-10-06 17:03:44 -0300
committerRoald de Vries <rdevries@thoughtworks.com>2016-10-07 18:25:02 -0300
commitf4d7541c9b6dcf67b57b13f7ca7434ec68eeb59c (patch)
tree8d50a54a9a8d5dd451253e55275f209f9df32b0a /service/test/support/integration/soledad_test_base.py
parent4642cee939c08bfa809f55b6a85ffa773600eaf9 (diff)
use test client in test case through composition instead of inheritance
Diffstat (limited to 'service/test/support/integration/soledad_test_base.py')
-rw-r--r--service/test/support/integration/soledad_test_base.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/service/test/support/integration/soledad_test_base.py b/service/test/support/integration/soledad_test_base.py
index e3e582d2..0ab07490 100644
--- a/service/test/support/integration/soledad_test_base.py
+++ b/service/test/support/integration/soledad_test_base.py
@@ -18,12 +18,13 @@ from leap.mail.adaptors.soledad import SoledadMailAdaptor
from leap.mail.mail import Message
from twisted.internet import defer
from twisted.trial import unittest
-from pixelated.adapter.mailstore import LeapMailStore
from test.support.integration.app_test_client import AppTestClient
+from test.support.integration.multi_user_client import MultiUserClient
from leap.common.events.flags import set_events_enabled
-class SoledadTestBase(unittest.TestCase, AppTestClient):
+class SoledadTestBase(unittest.TestCase):
+ Client = AppTestClient
# these are so long because our CI is so slow at the moment.
DEFERRED_TIMEOUT = 120
DEFERRED_TIMEOUT_LONG = 300
@@ -34,18 +35,24 @@ class SoledadTestBase(unittest.TestCase, AppTestClient):
super(SoledadTestBase, self).setUp()
self.adaptor = SoledadMailAdaptor()
self.mbox_uuid = str(uuid4())
- yield self.start_client()
+ yield self.app_test_client.start_client()
def tearDown(self):
set_events_enabled(True)
- self.cleanup()
+ self.app_test_client.cleanup()
+
+ @property
+ def app_test_client(self):
+ if not hasattr(self, '_app_test_client'):
+ self._app_test_client = self.Client()
+ return self._app_test_client
@defer.inlineCallbacks
def _create_mail_in_soledad(self, mail):
- yield self.adaptor.initialize_store(self.soledad)
- mbox = yield self.adaptor.get_or_create_mbox(self.soledad, 'INBOX')
+ yield self.adaptor.initialize_store(self.app_test_client.soledad)
+ mbox = yield self.adaptor.get_or_create_mbox(self.app_test_client.soledad, 'INBOX')
message = self._convert_mail_to_leap_message(mail, mbox.uuid)
- yield self.adaptor.create_msg(self.soledad, message)
+ yield self.adaptor.create_msg(self.app_test_client.soledad, message)
defer.returnValue(message.get_wrapper().mdoc.doc_id)
@@ -53,3 +60,7 @@ class SoledadTestBase(unittest.TestCase, AppTestClient):
message = self.adaptor.get_msg_from_string(Message, mail.as_string())
message.get_wrapper().set_mbox_uuid(mbox_uuid)
return message
+
+
+class MultiUserSoledadTestBase(SoledadTestBase):
+ Client = MultiUserClient