From db9917a769edacfffc9ae1166f07473a30471ef2 Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Fri, 19 Aug 2016 16:55:28 -0300 Subject: 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 --- service/test/unit/config/test_leap.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'service/test/unit/config') 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) -- cgit v1.2.3