You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

20 lines
588 B

"""Test the exceptions module."""
from unittest.mock import Mock
import pytest
from keycloak.exceptions import KeycloakOperationError, raise_error_from_response
def test_raise_error_from_response_from_dict():
"""Test raise error from response using a dictionary."""
response = Mock()
response.json.return_value = {"key": "value"}
response.status_code = 408
response.content = "Error"
with pytest.raises(KeycloakOperationError):
raise_error_from_response(
response=response, error=dict(), expected_codes=[200], skip_exists=False
)