From 6d7dd39fb3d4f138595f885d19315008d13f8907 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 15 Feb 2017 01:53:01 +0100 Subject: [tests] fix tests --- server/src/leap/soledad/server/auth.py | 4 ++-- server/src/leap/soledad/server/entrypoint.py | 1 - server/src/leap/soledad/server/session.py | 8 +++++--- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'server/src/leap/soledad') diff --git a/server/src/leap/soledad/server/auth.py b/server/src/leap/soledad/server/auth.py index aea003ff..c52370cb 100644 --- a/server/src/leap/soledad/server/auth.py +++ b/server/src/leap/soledad/server/auth.py @@ -55,7 +55,6 @@ class SoledadRealm(object): self._sync_pool = sync_pool def requestAvatar(self, avatarId, mind, *interfaces): - log.warn('avatarId {0}'.format(avatarId)) enable_blobs = self._conf['blobs'] # Anonymous access @@ -66,7 +65,8 @@ class SoledadRealm(object): # Authenticated users - # XXX review this... we're creating a Resource tree + # TODO review this: #8770 ---------------- + # we're creating a Resource tree # for each request, for every user. # What are the perf implications of this?? diff --git a/server/src/leap/soledad/server/entrypoint.py b/server/src/leap/soledad/server/entrypoint.py index b10bfed6..8078a54a 100644 --- a/server/src/leap/soledad/server/entrypoint.py +++ b/server/src/leap/soledad/server/entrypoint.py @@ -35,7 +35,6 @@ conf = get_config() class SoledadEntrypoint(SoledadSession): def __init__(self): - self._credentialFactories = [] SoledadSession.__init__(self) diff --git a/server/src/leap/soledad/server/session.py b/server/src/leap/soledad/server/session.py index 70e4a35b..515fd9b3 100644 --- a/server/src/leap/soledad/server/session.py +++ b/server/src/leap/soledad/server/session.py @@ -22,6 +22,7 @@ from zope.interface import implementer from twisted.cred.credentials import Anonymous from twisted.cred import error from twisted.logger import Logger +from twisted.python import log from twisted.web import util from twisted.web._auth import wrapper from twisted.web.guard import HTTPAuthSessionWrapper @@ -33,9 +34,6 @@ from leap.soledad.server.auth import credentialFactory from leap.soledad.server.url_mapper import URLMapper -log = Logger() - - @implementer(IResource) class UnauthorizedResource(wrapper.UnauthorizedResource): isLeaf = True @@ -63,6 +61,8 @@ class SoledadSession(HTTPAuthSessionWrapper): self._mapper = URLMapper() self._portal = portal self._credentialFactory = credentialFactory + # expected by the contract of the parent class + self._credentialFactories = [credentialFactory] def _matchPath(self, request): match = self._mapper.match(request.path, request.method) @@ -97,6 +97,8 @@ class SoledadSession(HTTPAuthSessionWrapper): except error.LoginFailed: return UnauthorizedResource() except: + # If you port this to the newer log facility, be aware that + # the tests rely on the error to be logged. log.err(None, "Unexpected failure from credentials factory") return ErrorPage(500, None, None) -- cgit v1.2.3