Fixtures
This commit is contained in:
28
tests/test_endpoints/test_cities.py
Normal file
28
tests/test_endpoints/test_cities.py
Normal file
@ -0,0 +1,28 @@
|
||||
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
|
||||
Reference in New Issue
Block a user