diff options
Diffstat (limited to 'service')
-rw-r--r-- | service/pixelated/application.py | 13 | ||||
-rw-r--r-- | service/test/support/integration/multi_user_client.py | 16 |
2 files changed, 9 insertions, 20 deletions
diff --git a/service/pixelated/application.py b/service/pixelated/application.py index 07488985..e273612d 100644 --- a/service/pixelated/application.py +++ b/service/pixelated/application.py @@ -160,7 +160,13 @@ def _start_in_multi_user_mode(args, root_resource, services_factory): events_server.ensure_server() config, provider = initialize_leap_provider(args.provider, args.leap_provider_cert, args.leap_provider_cert_fingerprint, args.leap_home) + protected_resource = set_up_protected_resources(root_resource, provider, services_factory) + start_site(args, protected_resource) + reactor.getThreadPool().adjustPoolsize(5, 15) + return defer.succeed(None) + +def set_up_protected_resources(root_resource, provider, services_factory): checker = LeapPasswordChecker(provider) session_checker = SessionChecker() anonymous_resource = LoginResource(services_factory) @@ -170,13 +176,8 @@ def _start_in_multi_user_mode(args, root_resource, services_factory): protected_resource = PixelatedAuthSessionWrapper(_portal, root_resource, anonymous_resource, []) anonymous_resource.set_portal(_portal) - - start_site(args, protected_resource) - root_resource.initialize(_portal) - reactor.getThreadPool().adjustPoolsize(5, 15) - - return defer.succeed(None) + return protected_resource def _start_in_single_user_mode(args, resource, services_factory): diff --git a/service/test/support/integration/multi_user_client.py b/service/test/support/integration/multi_user_client.py index c610c3e8..897799aa 100644 --- a/service/test/support/integration/multi_user_client.py +++ b/service/test/support/integration/multi_user_client.py @@ -27,7 +27,7 @@ from leap.auth import SRPAuth from pixelated.adapter.mailstore.leap_attachment_store import LeapAttachmentStore from pixelated.adapter.services.feedback_service import FeedbackService -from pixelated.application import UserAgentMode, ServicesFactory +from pixelated.application import UserAgentMode, ServicesFactory, set_up_protected_resources from pixelated.adapter.mailstore import LeapMailStore from pixelated.adapter.mailstore.searchable_mailstore import SearchableMailStore @@ -58,20 +58,8 @@ class MultiUserClient(AppTestClient): self.service_factory = ServicesFactory(UserAgentMode(is_single_user=False)) root_resource = RootResource(self.service_factory) - anonymous_resource = LoginResource(self.service_factory) - leap_provider = mock() - checker = LeapPasswordChecker(leap_provider) - session_checker = SessionChecker() - - realm = PixelatedRealm(root_resource, anonymous_resource) - _portal = portal.Portal(realm, [checker, session_checker, AllowAnonymousAccess()]) - - protected_resource = PixelatedAuthSessionWrapper(_portal, root_resource, anonymous_resource, []) - anonymous_resource.set_portal(_portal) - root_resource.initialize(_portal) - - self.resource = protected_resource + self.resource = set_up_protected_resources(root_resource, leap_provider, self.service_factory) @defer.inlineCallbacks def login(self, username='username', password='password'): |