29 lines
977 B
Python
29 lines
977 B
Python
import pytest
|
|
from litestar.status_codes import HTTP_200_OK
|
|
from litestar.testing import AsyncTestClient
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from tests.factories.city_factory import CityFactory
|
|
|
|
|
|
class TestCitiesEndpoints:
|
|
@pytest.fixture(scope="function", autouse=True)
|
|
def setup_class(self, db_session: AsyncSession, async_client: AsyncTestClient):
|
|
self.db_session = db_session
|
|
self.async_client = async_client
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get(self):
|
|
city_1 = await CityFactory.create()
|
|
city_2 = await CityFactory.create()
|
|
city_3 = await CityFactory.create()
|
|
city_4 = await CityFactory.create()
|
|
city_5 = await CityFactory.create()
|
|
|
|
async with self.async_client as client:
|
|
response = await client.get("/v1/cities")
|
|
print("#" * 100)
|
|
print(response.json())
|
|
print("#" * 100)
|
|
assert response.status_code == HTTP_200_OK
|