From 62e7904d8791a600474ca6491db75eb9102a1093 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Fri, 23 Sep 2016 15:28:59 -0300 Subject: Replace SRPSession usages with bonafide In order to replace leap_auth with bonafide, we created a class to hold the user credentials --- service/test/unit/resources/test_login_resource.py | 11 +++++------ service/test/unit/resources/test_users_resource.py | 9 +-------- 2 files changed, 6 insertions(+), 14 deletions(-) (limited to 'service/test/unit/resources') diff --git a/service/test/unit/resources/test_login_resource.py b/service/test/unit/resources/test_login_resource.py index c2b89654..6383e25c 100644 --- a/service/test/unit/resources/test_login_resource.py +++ b/service/test/unit/resources/test_login_resource.py @@ -2,17 +2,16 @@ import os import test.support.mockito -from leap.exceptions import SRPAuthenticationError +from leap.bonafide._srp import SRPAuthError from mock import patch from mockito import mock, when, any as ANY, verify, verifyZeroInteractions, verifyNoMoreInteractions from twisted.trial import unittest from twisted.web.resource import IResource from twisted.web.test.requesthelper import DummyRequest -from pixelated.config.sessions import LeapSessionFactory, LeapSession -from pixelated.resources.login_resource import ( - LoginResource, - parse_accept_language) +from pixelated.config.sessions import LeapSession +from pixelated.resources.login_resource import LoginResource +from pixelated.resources.login_resource import parse_accept_language from test.unit.resources import DummySite @@ -246,7 +245,7 @@ class TestLoginPOST(unittest.TestCase): @patch('leap.auth.SRPAuth.authenticate') @patch('pixelated.config.services.Services.setup') def test_leap_session_is_not_created_when_leap_auth_fails(self, mock_service_setup, mock_leap_srp_auth, mock_leap_session_create): - mock_leap_srp_auth.side_effect = SRPAuthenticationError() + mock_leap_srp_auth.side_effect = SRPAuthError() d = self.web.get(self.request) diff --git a/service/test/unit/resources/test_users_resource.py b/service/test/unit/resources/test_users_resource.py index 9862209d..417bbcc9 100644 --- a/service/test/unit/resources/test_users_resource.py +++ b/service/test/unit/resources/test_users_resource.py @@ -1,17 +1,10 @@ -import os - import test.support.mockito -from leap.exceptions import SRPAuthenticationError -from mock import patch -from mockito import mock, when, any as ANY, verify, verifyZeroInteractions, verifyNoMoreInteractions +from mockito import mock, when, verify from twisted.trial import unittest -from twisted.web.resource import IResource from twisted.web.test.requesthelper import DummyRequest -from pixelated.config.sessions import LeapSessionFactory, LeapSession from pixelated.config.services import Services, ServicesFactory -from pixelated.resources.login_resource import LoginResource from pixelated.resources.users import UsersResource from test.unit.resources import DummySite -- cgit v1.2.3