[TC-221]: init template-backend-service (#1)
https://eva.avroid.tech/desk/cards?obj=Task:TC-221 Начальная версия сервиса-шаблона Co-authored-by: Nadezhda <nadezhda.lavrentieva@avroid.team> Reviewed-on: https://git.avroid.tech/Templates/template-backend-service/pulls/1 Reviewed-by: Victor Stratov <victor.stratov@avroid.tech>
This commit is contained in:
23
tests/test_routes.py
Normal file
23
tests/test_routes.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import pytest
|
||||
from aiopg.sa import SAConnection
|
||||
from httpx import AsyncClient
|
||||
|
||||
from src.repositories.tables import messenger_handbook_country_table
|
||||
from tests.samples import ACCOUNT_1, ACCOUNT_2
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sa_tables():
|
||||
return [messenger_handbook_country_table]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
async def _enter_data(connection: SAConnection):
|
||||
await connection.execute(messenger_handbook_country_table.insert().values([ACCOUNT_1, ACCOUNT_2]))
|
||||
|
||||
|
||||
async def test_get_info_from_postgresql(test_client: AsyncClient):
|
||||
response = await test_client.get("/test_psql/1")
|
||||
response_json = response.json()
|
||||
|
||||
assert (response.status_code, response_json) == (200, [ACCOUNT_1])
|
||||
Reference in New Issue
Block a user