Esempio n. 1
0
    def test_authenticate_user_calls_initinal_sync(self, session_factory__ctor_mock):
        session_factory_mock = session_factory__ctor_mock.return_value
        provider_mock = MagicMock()
        auth_mock = MagicMock()
        session = MagicMock()

        session_factory_mock.create.return_value = session

        yield authenticate_user(provider_mock, 'username', 'password', auth=auth_mock)

        session.initial_sync.assert_called_with()
Esempio n. 2
0
    def test_authenticate_user_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()
        session = MagicMock()

        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)

        session.close.assert_called_with()
        self.assertEqual(2, session.initial_sync.call_count)
Esempio n. 3
0
 def _authententicate_user(_):
     return authenticate_user(self._leap_provider, credentials.username, credentials.password)
Esempio n. 4
0
 def _get_leap_session(srp_auth):
     return authenticate_user(self._leap_provider, credentials.username, credentials.password, auth=srp_auth)
Esempio n. 5
0
 def _get_leap_session(srp_auth):
     return authenticate_user(self._leap_provider, credentials.username, credentials.password, auth=srp_auth)