summaryrefslogtreecommitdiff
path: root/service/test/unit
diff options
context:
space:
mode:
authorTulio Casagrande <tcasagra@thoughtworks.com>2016-09-23 15:28:59 -0300
committerTulio Casagrande <tcasagra@thoughtworks.com>2016-09-23 15:38:47 -0300
commit62e7904d8791a600474ca6491db75eb9102a1093 (patch)
tree180235903c9c0d195083f89fb740f641218a7319 /service/test/unit
parente2cb0deda1e0668dd23e0fefc8020d10c1cad488 (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/unit')
-rw-r--r--service/test/unit/bitmask_libraries/test_smtp_client_certificate.py6
-rw-r--r--service/test/unit/resources/test_login_resource.py11
-rw-r--r--service/test/unit/resources/test_users_resource.py9
3 files changed, 9 insertions, 17 deletions
diff --git a/service/test/unit/bitmask_libraries/test_smtp_client_certificate.py b/service/test/unit/bitmask_libraries/test_smtp_client_certificate.py
index 050f2d94..c9a51694 100644
--- a/service/test/unit/bitmask_libraries/test_smtp_client_certificate.py
+++ b/service/test/unit/bitmask_libraries/test_smtp_client_certificate.py
@@ -16,10 +16,10 @@
import os
import unittest
import tempdir
-from leap.srp_session import SRPSession
import leap.common.certs as certs
-from mockito import mock, unstub, when, verify, never, any as ANY
+from mockito import mock, unstub, when, any as ANY
+from pixelated.config.authentication import Authentication
from pixelated.config.sessions import SmtpClientCertificate
from tempfile import NamedTemporaryFile
@@ -57,7 +57,7 @@ class TestSmtpClientCertificate(unittest.TestCase):
self.provider.api_version = '1'
self.provider.server_name = 'some.host.tld'
self.provider.domain = 'some-provider.tld'
- self.auth = SRPSession(USERNAME, 'token', 'uuid', 'session_id', {})
+ self.auth = Authentication(USERNAME, 'token', 'uuid', 'session_id', {})
self.pem_path = os.path.join(self.tmp_dir.name, 'providers', 'some-provider.tld', 'keys', 'client', 'smtp.pem')
def tearDown(self):
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