File: test_auth.py

package info (click to toggle)
python-autarco 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 808 kB
  • sloc: python: 742; makefile: 3
file content (23 lines) | stat: -rw-r--r-- 623 bytes parent folder | download
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")