Skip to content

Commit

Permalink
Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
timmo001 committed Apr 1, 2024
1 parent ae56615 commit 00ed2ee
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""Fixtures for testing."""

from collections.abc import AsyncGenerator

from aiohttp import ClientSession
from aioresponses import aioresponses
import pytest

from aiolyric.client import LyricClient
from aiolyric.const import AUTH_URL, BASE_URL, TOKEN_URL

from . import RESPONSE_JSON_BASIC


@pytest.fixture(autouse=True)
def mock_aioresponse():
"""Return a client session."""
with aioresponses() as mocker:
mocker.get(
AUTH_URL,
payload=RESPONSE_JSON_BASIC,
status=200,
repeat=True,
)
mocker.get(
TOKEN_URL,
payload=RESPONSE_JSON_BASIC,
status=200,
repeat=True,
)
mocker.get(
BASE_URL,
payload=RESPONSE_JSON_BASIC,
status=200,
repeat=True,
)

yield mocker


@pytest.fixture
async def lyric_client() -> AsyncGenerator[LyricClient, None]:
"""Return a LyricClient."""
async with ClientSession() as session:
yield LyricClient(session=session)

0 comments on commit 00ed2ee

Please sign in to comment.