summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2015-02-03 09:14:10 -0200
committerDuda Dornelles <ddornell@thoughtworks.com>2015-02-03 12:36:17 -0200
commit6904acf34524b84d70d0054a5bb953a1bf9c784a (patch)
tree491716eed52ae2acaed11584add6ba13af19295f /service
parentab6955b3fbc5b89ad80fcade0702b54efb9ef682 (diff)
Enabling integration tests to be run in parallel
If we were using twisted 12.3.0, this change would allow us to run the tests with 'trial -j <number of tests to run in parallel>'. In a simple test in my box the integration test suite got 3x faster
Diffstat (limited to 'service')
-rw-r--r--service/test/integration/test_contacts.py3
-rw-r--r--service/test/integration/test_delete_mail.py6
-rw-r--r--service/test/integration/test_drafts.py6
-rw-r--r--service/test/integration/test_mark_as_read_unread.py6
-rw-r--r--service/test/integration/test_retrieve_attachment.py6
-rw-r--r--service/test/integration/test_search.py3
-rw-r--r--service/test/integration/test_soledad_querier.py3
-rw-r--r--service/test/integration/test_tags.py6
-rw-r--r--service/test/support/integration/app_test_client.py6
-rw-r--r--service/test/support/integration/soledad_test_base.py3
10 files changed, 8 insertions, 40 deletions
diff --git a/service/test/integration/test_contacts.py b/service/test/integration/test_contacts.py
index 1a471440..4974c471 100644
--- a/service/test/integration/test_contacts.py
+++ b/service/test/integration/test_contacts.py
@@ -18,9 +18,6 @@ from test.support.integration import SoledadTestBase, MailBuilder
class ContactsTest(SoledadTestBase):
- def setUp(self):
- SoledadTestBase.setUp(self)
-
def test_TO_CC_and_BCC_fields_are_being_searched(self):
input_mail = MailBuilder().with_tags(['important']).build_input_mail()
self.client.add_mail_to_inbox(input_mail)
diff --git a/service/test/integration/test_delete_mail.py b/service/test/integration/test_delete_mail.py
index 5a3a97fb..91dc0e9e 100644
--- a/service/test/integration/test_delete_mail.py
+++ b/service/test/integration/test_delete_mail.py
@@ -19,12 +19,6 @@ from test.support.integration import *
class DeleteMailTest(SoledadTestBase):
- def setUp(self):
- SoledadTestBase.setUp(self)
-
- def tearDown(self):
- SoledadTestBase.tearDown(self)
-
def test_move_mail_to_trash_when_deleting(self):
input_mail = MailBuilder().with_subject('Mail with tags').build_input_mail()
self.client.add_mail_to_inbox(input_mail)
diff --git a/service/test/integration/test_drafts.py b/service/test/integration/test_drafts.py
index d4fde099..c555cb89 100644
--- a/service/test/integration/test_drafts.py
+++ b/service/test/integration/test_drafts.py
@@ -19,12 +19,6 @@ from test.support.integration import *
class DraftsTest(SoledadTestBase):
- def setUp(self):
- SoledadTestBase.setUp(self)
-
- def tearDown(self):
- SoledadTestBase.tearDown(self)
-
def test_post_sends_mail_and_deletes_previous_draft_if_it_exists(self):
# creates one draft
first_draft = MailBuilder().with_subject('First draft').build_json()
diff --git a/service/test/integration/test_mark_as_read_unread.py b/service/test/integration/test_mark_as_read_unread.py
index 86a48e62..cc09acec 100644
--- a/service/test/integration/test_mark_as_read_unread.py
+++ b/service/test/integration/test_mark_as_read_unread.py
@@ -20,12 +20,6 @@ from pixelated.adapter.model.status import Status
class MarkAsReadUnreadTest(SoledadTestBase):
- def setUp(self):
- SoledadTestBase.setUp(self)
-
- def tearDown(self):
- SoledadTestBase.tearDown(self)
-
def test_mark_single_as_read(self):
input_mail = MailBuilder().build_input_mail()
self.client.add_mail_to_inbox(input_mail)
diff --git a/service/test/integration/test_retrieve_attachment.py b/service/test/integration/test_retrieve_attachment.py
index d6ad9298..c81b684a 100644
--- a/service/test/integration/test_retrieve_attachment.py
+++ b/service/test/integration/test_retrieve_attachment.py
@@ -19,12 +19,6 @@ from test.support.integration.soledad_test_base import SoledadTestBase
class RetrieveAttachmentTest(SoledadTestBase):
- def setUp(self):
- SoledadTestBase.setUp(self)
-
- def tearDown(self):
- SoledadTestBase.tearDown(self)
-
def test_attachment_content_is_retrieved(self):
ident = 'F4E99C1CEC4D300A4223A96CCABBE0304BDBC31C550A5A03E207A5E4C3C71A22'
attachment_dict = {'content-disposition': 'attachment',
diff --git a/service/test/integration/test_search.py b/service/test/integration/test_search.py
index 1fb22a38..68a808dd 100644
--- a/service/test/integration/test_search.py
+++ b/service/test/integration/test_search.py
@@ -19,9 +19,6 @@ from test.support.integration import *
class SearchTest(SoledadTestBase):
- def setUp(self):
- SoledadTestBase.setUp(self)
-
def test_that_tags_returns_all_tags(self):
input_mail = MailBuilder().with_tags(['important']).build_input_mail()
self.client.add_mail_to_inbox(input_mail)
diff --git a/service/test/integration/test_soledad_querier.py b/service/test/integration/test_soledad_querier.py
index f8767630..9c7f8a81 100644
--- a/service/test/integration/test_soledad_querier.py
+++ b/service/test/integration/test_soledad_querier.py
@@ -29,9 +29,6 @@ class SoledadQuerierTest(SoledadTestBase, WithMsgFields):
self.maxDiff = None
self.soledad_querier = self.client.soledad_querier
- def tearDown(self):
- SoledadTestBase.tearDown(self)
-
def _get_empty_mailbox(self):
return copy.deepcopy(self.EMPTY_MBOX)
diff --git a/service/test/integration/test_tags.py b/service/test/integration/test_tags.py
index 0efcbb6b..1de6d3fa 100644
--- a/service/test/integration/test_tags.py
+++ b/service/test/integration/test_tags.py
@@ -21,12 +21,6 @@ from pixelated.adapter.services.tag_service import TagService
class TagsTest(SoledadTestBase):
- def setUp(self):
- SoledadTestBase.setUp(self)
-
- def tearDown(self):
- SoledadTestBase.tearDown(self)
-
def _tags_json(self, tags):
return json.dumps({'newtags': tags})
diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py
index d60d84dc..8d8d0d1f 100644
--- a/service/test/support/integration/app_test_client.py
+++ b/service/test/support/integration/app_test_client.py
@@ -37,6 +37,7 @@ from twisted.internet import reactor
from twisted.internet.defer import succeed
from twisted.web.resource import getChildForRequest
from twisted.web.server import Site
+import uuid
class AppTestClient:
@@ -45,7 +46,10 @@ class AppTestClient:
def __init__(self, soledad_test_folder='/tmp/soledad-test/test'):
+ soledad_test_folder = os.path.join(soledad_test_folder, str(uuid.uuid4()))
self.soledad = initialize_soledad(tempdir=soledad_test_folder)
+ self.cleanup = lambda: shutil.rmtree(soledad_test_folder)
+
self.mail_address = "test@pixelated.org"
# setup app
@@ -65,7 +69,7 @@ class AppTestClient:
self.draft_service = DraftService(self.mailboxes)
self.mail_service = MailService(self.mailboxes, self.mail_sender, self.tag_service,
self.soledad_querier)
- self.search_engine = SearchEngine(self.soledad_querier)
+ self.search_engine = SearchEngine(self.soledad_querier, agent_home=soledad_test_folder)
self.search_engine.index_mails(self.mail_service.all_mails())
self.app.resource = RootResource()
diff --git a/service/test/support/integration/soledad_test_base.py b/service/test/support/integration/soledad_test_base.py
index eea510b9..60b88768 100644
--- a/service/test/support/integration/soledad_test_base.py
+++ b/service/test/support/integration/soledad_test_base.py
@@ -27,6 +27,9 @@ class SoledadTestBase(unittest.TestCase):
def setUp(self):
self.client = AppTestClient()
+ def tearDown(self):
+ self.client.cleanup()
+
def get_mails_by_tag(self, tag, page=1, window=100):
tags = 'tag:%s' % tag
return self.search(tags, page, window)