1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
"""Auth tests for Autarcp."""
# pylint: disable=protected-access
import pytest
from aresponses import ResponsesMockServer
from autarco import Autarco
from autarco.exceptions import AutarcoAuthenticationError
async def test_authentication_error(
aresponses: ResponsesMockServer,
autarco_client: Autarco,
) -> None:
"""Test authentication error is handled correctly."""
aresponses.add(
"my.autarco.com",
"/api/site/test",
"GET",
aresponses.Response(status=401),
)
with pytest.raises(AutarcoAuthenticationError):
assert await autarco_client._request("test")
|