diff options
author | Tulio Casagrande <tcasagra@thoughtworks.com> | 2016-09-23 15:28:59 -0300 |
---|---|---|
committer | Tulio Casagrande <tcasagra@thoughtworks.com> | 2016-09-23 15:38:47 -0300 |
commit | 62e7904d8791a600474ca6491db75eb9102a1093 (patch) | |
tree | 180235903c9c0d195083f89fb740f641218a7319 /service/test/support | |
parent | e2cb0deda1e0668dd23e0fefc8020d10c1cad488 (diff) |
Replace SRPSession usages with bonafide
In order to replace leap_auth with bonafide, we created a
class to hold the user credentials
Diffstat (limited to 'service/test/support')
-rw-r--r-- | service/test/support/integration/app_test_client.py | 6 | ||||
-rw-r--r-- | service/test/support/integration/multi_user_client.py | 8 |
2 files changed, 6 insertions, 8 deletions
diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py index 3a3b7ddf..352ff9c6 100644 --- a/service/test/support/integration/app_test_client.py +++ b/service/test/support/integration/app_test_client.py @@ -16,7 +16,6 @@ import json import multiprocessing from leap.mail.adaptors.soledad import SoledadMailAdaptor -from leap.srp_session import SRPSession from mockito import mock import os import shutil @@ -35,10 +34,11 @@ from zope.interface import implementer from twisted.cred import checkers, credentials from pixelated.adapter.mailstore.leap_attachment_store import LeapAttachmentStore from pixelated.adapter.services.feedback_service import FeedbackService -from pixelated.application import ServicesFactory, UserAgentMode, SingleUserServicesFactory, set_up_protected_resources +from pixelated.application import UserAgentMode, set_up_protected_resources from pixelated.config.sessions import LeapSession from pixelated.config.services import Services, ServicesFactory, SingleUserServicesFactory from pixelated.config.site import PixelatedSite +from pixelated.config.authentication import Authentication from pixelated.adapter.mailstore import LeapMailStore from pixelated.adapter.mailstore.searchable_mailstore import SearchableMailStore @@ -136,7 +136,7 @@ class StubSRPChecker(object): def requestAvatarId(self, credentials): if(self._credentials[credentials.username] == credentials.password): - leap_auth = SRPSession(credentials.username, uuid.uuid4(), uuid.uuid4(), uuid.uuid4(), {}) + leap_auth = Authentication(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() diff --git a/service/test/support/integration/multi_user_client.py b/service/test/support/integration/multi_user_client.py index 75168128..2530db46 100644 --- a/service/test/support/integration/multi_user_client.py +++ b/service/test/support/integration/multi_user_client.py @@ -13,16 +13,14 @@ # # 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 leap.exceptions import SRPAuthenticationError from mockito import mock, when, any as ANY from twisted.internet import defer -from leap.auth import SRPSession - from pixelated.application import UserAgentMode, set_up_protected_resources from pixelated.config.services import ServicesFactory -from pixelated.config.sessions import LeapSessionFactory, LeapSession +from pixelated.config.sessions import LeapSessionFactory +from pixelated.config.authentication import Authentication import pixelated.config.services from pixelated.resources.root_resource import RootResource from test.support.integration import AppTestClient @@ -53,7 +51,7 @@ class MultiUserClient(AppTestClient): def login(self, username='username', password='password'): if(username == 'username' and password == 'password'): self.credentials_checker.add_user(username, password) - session = SRPSession(username, 'some_user_token', 'some_user_uuid', 'session_id', {'is_admin': False}) + session = Authentication(username, 'some_user_token', 'some_user_uuid', 'session_id', {'is_admin': False}) leap_session = self._test_account.leap_session leap_session.user_auth = session config = mock() |