1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
"""Define tests for the client object."""
import aiohttp
import pytest
from pyseventeentrack import Client
from pyseventeentrack.errors import RequestError
@pytest.mark.asyncio
async def test_bad_request(aresponses):
"""Test that a failed login returns the correct response."""
aresponses.add(
"random.domain", "/no/good", "get", aresponses.Response(text="", status=404)
)
with pytest.raises(RequestError):
async with aiohttp.ClientSession() as session:
client = Client(session=session)
await client._request("get", "https://random.domain/no/good") # pylint: disable=protected-access
|