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.
23 lines
629 B
23 lines
629 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() -> None:
|
|
"""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={},
|
|
expected_codes=[200],
|
|
skip_exists=False,
|
|
)
|