summaryrefslogtreecommitdiff
path: root/service/test/support
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-10-15 09:42:08 +0200
committerDuda Dornelles <ddornell@thoughtworks.com>2014-10-15 09:42:08 +0200
commit89d26f3cd389f41b83d27ea225944a0ff8bc2e95 (patch)
tree31275a0e7c350fd2b9acc2d1210d972bb9a0d3c8 /service/test/support
parent6d08b8e65d2c1679d4b489ac196116847f91b3a7 (diff)
Getting rid of singletons and optimizing imports
Diffstat (limited to 'service/test/support')
-rw-r--r--service/test/support/integration_helper.py19
-rw-r--r--service/test/support/test_helper.py3
2 files changed, 10 insertions, 12 deletions
diff --git a/service/test/support/integration_helper.py b/service/test/support/integration_helper.py
index 7b6af2e4..2316774a 100644
--- a/service/test/support/integration_helper.py
+++ b/service/test/support/integration_helper.py
@@ -14,12 +14,12 @@
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
import json
+import shutil
from leap.soledad.client import Soledad
from mockito import mock, unstub
import os
from mock import Mock
-import shutil
from pixelated.adapter.mail_service import MailService
from pixelated.adapter.search import SearchEngine
from pixelated.adapter.status import Status
@@ -139,24 +139,21 @@ class SoledadTestBase:
self.soledad = initialize_soledad(tempdir=soledad_test_folder)
self.mail_address = "test@pixelated.org"
- # resetting soledad querier
- SoledadQuerier.reset()
- SoledadQuerier.get_instance(soledad=self.soledad)
-
# setup app
PixelatedMail.from_email_address = self.mail_address
- self.app = pixelated.user_agent.app.test_client()
pixelated.user_agent.DISABLED_FEATURES.append('autoReload')
+ SearchEngine.INDEX_FOLDER = soledad_test_folder + '/search_index'
+
+ self.app = pixelated.user_agent.app.test_client()
+
+ self.soledad_querier = SoledadQuerier(self.soledad)
self.account = FakeAccount()
- self.pixelated_mailboxes = PixelatedMailBoxes(self.account)
+ self.pixelated_mailboxes = PixelatedMailBoxes(self.account, self.soledad_querier)
self.mail_sender = mock()
self.tag_service = TagService()
self.draft_service = DraftService(self.pixelated_mailboxes)
- self.mail_service = MailService(self.pixelated_mailboxes, self.mail_sender, self.tag_service)
-
- SearchEngine.INDEX_FOLDER = soledad_test_folder + '/search_index'
+ self.mail_service = MailService(self.pixelated_mailboxes, self.mail_sender, self.tag_service, self.soledad_querier)
self.search_engine = SearchEngine()
-
self.search_engine.index_mails(self.mail_service.all_mails())
pixelated.user_agent.mail_service = self.mail_service
diff --git a/service/test/support/test_helper.py b/service/test/support/test_helper.py
index af0fed95..66ed9a10 100644
--- a/service/test/support/test_helper.py
+++ b/service/test/support/test_helper.py
@@ -13,10 +13,11 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
-from mock import Mock
from datetime import datetime
+
from pixelated.adapter.pixelated_mail import InputMail
+
LEAP_FLAGS = ['\\Seen',
'\\Answered',
'\\Flagged',