Esempio n. 1
0
 def create_auth_handler(token_provider, modifier=None):
     return AuthHandler(token_provider, modifier)
Esempio n. 2
0
def test_auth_handler_response_indicates_unauthorized_returns_false_for_non_401(
        mocker):
    mock_response = mocker.MagicMock(spec=Response)
    mock_response.status_code = 200
    assert not AuthHandler.response_indicates_unauthorized(mock_response)
Esempio n. 3
0
def test_auth_handler_renew_authentication_no_cache_calls_get_secret_value_on_token_provider_with_correct_params(
        mock_token_provider, mock_header_modifier, mock_session):
    auth_handler = AuthHandler(mock_token_provider, mock_header_modifier)
    auth_handler.renew_authentication(mock_session)
    mock_token_provider.get_secret_value.assert_called_once_with(
        force_refresh=True)
Esempio n. 4
0
def test_auth_handler_renew_authentication_no_cache_calls_modify_session_on_session_modifier_with_correct_params(
        mock_token_provider, mock_header_modifier, mock_session):
    auth_handler = AuthHandler(mock_token_provider, mock_header_modifier)
    auth_handler.renew_authentication(mock_session)
    mock_header_modifier.modify_session.assert_called_once_with(
        mock_session, TEST_SECRET)
Esempio n. 5
0
def test_auth_handler_constructs_successfully():
    assert AuthHandler(TokenProvider(), HeaderModifier())