summaryrefslogtreecommitdiff
path: root/service/test/support/integration/app_test_client.py
diff options
context:
space:
mode:
authorBruno Wagner <bwagner@riseup.net>2016-09-08 19:07:31 -0300
committerTulio Casagrande <tcasagra@thoughtworks.com>2016-09-12 14:39:33 -0300
commit8e7b7d53a6bef24ced29549746699f26595f4c71 (patch)
tree8a1fa8f0d5e3784a7795b97500616ed0954cc780 /service/test/support/integration/app_test_client.py
parent1114cfcfba7b67b9d3e6238ce9dc2ab578060f93 (diff)
multi_user_client now accounts for the login process
The login resource was being totally mocked out of the integration tests, I adapted the test client to touch the actual login code and fixed the multi_user_client to use the same checker the single user one was using. With that change we now have tests that cover the change of authenticating with bonafide
Diffstat (limited to 'service/test/support/integration/app_test_client.py')
-rw-r--r--service/test/support/integration/app_test_client.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py
index 5d1e760a..619062a8 100644
--- a/service/test/support/integration/app_test_client.py
+++ b/service/test/support/integration/app_test_client.py
@@ -31,7 +31,6 @@ from mock import Mock
from twisted.internet import reactor, defer
from twisted.internet.defer import succeed
from twisted.web.resource import getChildForRequest
-# from twisted.web.server import Site as PixelatedSite
from zope.interface import implementer
from twisted.cred import checkers, credentials
from pixelated.adapter.mailstore.leap_attachment_store import LeapAttachmentStore
@@ -136,8 +135,11 @@ class StubSRPChecker(object):
self._credentials[username] = password
def requestAvatarId(self, credentials):
- leap_auth = SRPSession(credentials.username, uuid.uuid4(), uuid.uuid4(), uuid.uuid4(), {})
- return defer.succeed(LeapSession(self._leap_provider, leap_auth, None, None, None, None))
+ if(self._credentials[credentials.username] == credentials.password):
+ leap_auth = SRPSession(credentials.username, uuid.uuid4(), uuid.uuid4(), uuid.uuid4(), {})
+ return defer.succeed(LeapSession(self._leap_provider, leap_auth, None, None, None, None))
+ else:
+ return defer.fail()
class StubServicesFactory(ServicesFactory):
@@ -196,7 +198,6 @@ class AppTestClient(object):
else:
self.service_factory = StubServicesFactory(self.accounts, mode)
provider = mock()
-
self.resource = set_up_protected_resources(RootResource(self.service_factory), provider, self.service_factory, checker=StubSRPChecker(provider))
@defer.inlineCallbacks