summaryrefslogtreecommitdiff
path: root/service/test
diff options
context:
space:
mode:
authorBruno Wagner <bwagner@riseup.net>2016-08-19 16:55:28 -0300
committerBruno Wagner <bwagner@riseup.net>2016-08-19 17:00:53 -0300
commitdb9917a769edacfffc9ae1166f07473a30471ef2 (patch)
treed048bbbfba7a31a87749afa721e37ec41c3e5ec1 /service/test
parent09fbc16dc6e55b3fa2f2c9ea7b3fba7eee981dfa (diff)
Normalizing single and multi user bootstrap #759
Consolidated authentication to always be done is a defer to thread and changed the authenticate_user method name to conform with what it actually does
Diffstat (limited to 'service/test')
-rw-r--r--service/test/unit/config/test_leap.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/service/test/unit/config/test_leap.py b/service/test/unit/config/test_leap.py
index 6b34d717..5576cca8 100644
--- a/service/test/unit/config/test_leap.py
+++ b/service/test/unit/config/test_leap.py
@@ -2,14 +2,14 @@ from leap.soledad.common.errors import InvalidAuthTokenError
from mock import MagicMock, patch
from twisted.trial import unittest
from twisted.internet import defer
-from pixelated.config.leap import authenticate_user
+from pixelated.config.leap import create_leap_session
class TestAuth(unittest.TestCase):
@patch('pixelated.config.leap.LeapSessionFactory')
@defer.inlineCallbacks
- def test_authenticate_user_calls_initinal_sync(self, session_factory__ctor_mock):
+ def test_create_leap_session_calls_initinal_sync(self, session_factory__ctor_mock):
session_factory_mock = session_factory__ctor_mock.return_value
provider_mock = MagicMock()
auth_mock = MagicMock()
@@ -17,13 +17,13 @@ class TestAuth(unittest.TestCase):
session_factory_mock.create.return_value = session
- yield authenticate_user(provider_mock, 'username', 'password', auth=auth_mock)
+ yield create_leap_session(provider_mock, 'username', 'password', auth=auth_mock)
session.initial_sync.assert_called_with()
@patch('pixelated.config.leap.LeapSessionFactory')
@defer.inlineCallbacks
- def test_authenticate_user_calls_initial_sync_a_second_time_if_invalid_auth_exception_is_raised(self, session_factory__ctor_mock):
+ def test_create_leap_session_calls_initial_sync_a_second_time_if_invalid_auth_exception_is_raised(self, session_factory__ctor_mock):
session_factory_mock = session_factory__ctor_mock.return_value
provider_mock = MagicMock()
auth_mock = MagicMock()
@@ -32,7 +32,7 @@ class TestAuth(unittest.TestCase):
session.initial_sync.side_effect = [InvalidAuthTokenError, defer.succeed(None)]
session_factory_mock.create.return_value = session
- yield authenticate_user(provider_mock, 'username', 'password', auth=auth_mock)
+ yield create_leap_session(provider_mock, 'username', 'password', auth=auth_mock)
session.close.assert_called_with()
self.assertEqual(2, session.initial_sync.call_count)