diff options
Diffstat (limited to 'service/test/support')
-rw-r--r-- | service/test/support/integration/app_test_client.py | 6 | ||||
-rw-r--r-- | service/test/support/integration/soledad_test_base.py | 3 |
2 files changed, 8 insertions, 1 deletions
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) |