summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-09-29 15:29:45 -0300
committerDuda Dornelles <ddornell@thoughtworks.com>2014-09-29 15:29:45 -0300
commit2a6f951e0d330cc2e30f7918e4bbcd221395d95f (patch)
treeca06a438121363daa9cddc6349e2c3aa9626c7e3
parenta40f42b124e8255873b7de62d6b732632fc68408 (diff)
refactoring integration tests and making sure to reset SoledadQuerier instance to None before running again
-rw-r--r--service/integration/__init__.py4
-rw-r--r--service/integration/mail_fetch_test.py7
2 files changed, 6 insertions, 5 deletions
diff --git a/service/integration/__init__.py b/service/integration/__init__.py
index 910c25d7..88357662 100644
--- a/service/integration/__init__.py
+++ b/service/integration/__init__.py
@@ -1,8 +1,8 @@
+import json
+
from leap.soledad.client import Soledad
import os
-import unittest
from mock import Mock
-import json
def initialize_soledad(tempdir):
diff --git a/service/integration/mail_fetch_test.py b/service/integration/mail_fetch_test.py
index bd2823a3..0b66fe1d 100644
--- a/service/integration/mail_fetch_test.py
+++ b/service/integration/mail_fetch_test.py
@@ -25,6 +25,7 @@ class MailFetchTest(unittest.TestCase):
self.mail_address = "test@pixelated.org"
self.soledad = initialize_soledad(tempdir=self.soledad_test_folder)
+ SoledadQuerier.instance = None
SoledadQuerier.get_instance(soledad=self.soledad)
PixelatedMail.from_email_address = self.mail_address
pixelated_mailboxes = PixelatedMailBoxes(self.account)
@@ -36,8 +37,8 @@ class MailFetchTest(unittest.TestCase):
import shutil
shutil.rmtree(self.soledad_test_folder)
- def get(self, url):
- return json.loads(self.app.get(url).data)
+ def get_mails_by_tag(self, tag):
+ return json.loads(self.app.get("/mails?q=tag" + tag).data)
def post_mail(self, data):
self.app.post('/mails', data=data, content_type="application/json")
@@ -49,7 +50,7 @@ class MailFetchTest(unittest.TestCase):
self.post_mail(mail_one)
self.post_mail(mail_two)
- response = self.get('/mails?q=tag:drafts')
+ response = self.get_mails_by_tag("drafts")
# ordered by creation date
self.assertEquals(u'Mail Two', response['mails'][0]['header']['subject'])