From e66b356f900bc9899a5506378163ffaadd4a32b5 Mon Sep 17 00:00:00 2001 From: Folker Bernitt Date: Wed, 27 Jan 2016 13:56:41 +0100 Subject: Add a login multi user functional test - Issue #576 - Extended AppTestClient with multi user support --- service/test/support/integration/multi_user_client.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'service/test/support/integration/multi_user_client.py') diff --git a/service/test/support/integration/multi_user_client.py b/service/test/support/integration/multi_user_client.py index af314fdf..2aa7d3ff 100644 --- a/service/test/support/integration/multi_user_client.py +++ b/service/test/support/integration/multi_user_client.py @@ -35,22 +35,23 @@ from pixelated.adapter.mailstore.searchable_mailstore import SearchableMailStore from pixelated.adapter.search import SearchEngine from pixelated.adapter.services.draft_service import DraftService from pixelated.bitmask_libraries.session import LeapSession, LeapSessionFactory -from pixelated.config import services as config_services +import pixelated.config.services # from pixelated.config.services import Services from pixelated.resources.auth import LeapPasswordChecker, SessionChecker, PixelatedRealm, PixelatedAuthSessionWrapper from pixelated.resources.login_resource import LoginResource from pixelated.resources.root_resource import RootResource from test.support.integration import AppTestClient from test.support.integration.app_test_client import initialize_soledad, AppTestAccount - +import test.support.mockito from test.support.test_helper import request_mock class MultiUserClient(AppTestClient): @defer.inlineCallbacks - def start_client(self): - self._test_account = AppTestAccount('test') + def start_client(self, mode=UserAgentMode(is_single_user=True)): + self._initialize() + self._test_account = AppTestAccount('test', self._tmp_dir.name) yield self._test_account.start() @@ -74,9 +75,9 @@ class MultiUserClient(AppTestClient): leap_session.fresh_account = False self._set_leap_srp_auth(username, password) + when(leap_session).initial_sync().thenAnswer(lambda: defer.succeed(None)) when(LeapSessionFactory).create(username, password).thenReturn(leap_session) - when(config_services).Services(leap_session).thenReturn(self._test_account.services) - # when(Services).setup().thenReturn(defer.succeed('mocked so irrelevant')) + when(pixelated.config.services).Services(ANY()).thenReturn(self._test_account.services) request = request_mock(path='/login', method="POST", body={'username': username, 'password': password}) return self._render(request, as_json=False) -- cgit v1.2.3