https://eva.avroid.tech/desk/Task/TC-642#be-dorabotat-shablon-servisov-backend Дорабатываем шаблон сервисов по требованиям: https://eva.avroid.tech/project/Document/DOC-002710#trebovanija-k-versijam Reviewed-on: https://git.avroid.tech/Templates/template-backend-service/pulls/3 Reviewed-by: Victor Stratov <victor.stratov@avroid.team> Reviewed-by: Petr Brovchenko <petr.brovchenko@avroid.team> Co-authored-by: Nadezhda <nadezhda.lavrentieva@avroid.team> Co-committed-by: Nadezhda <nadezhda.lavrentieva@avroid.team>
24 lines
631 B
Python
24 lines
631 B
Python
import pytest
|
|
from aiopg.sa import SAConnection
|
|
from httpx import AsyncClient
|
|
|
|
from src.repositories.tables.tables import todo_table
|
|
from tests.samples import ACCOUNT_1, ACCOUNT_2
|
|
|
|
|
|
@pytest.fixture
|
|
def sa_tables():
|
|
return [todo_table]
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
async def _enter_data(connection: SAConnection):
|
|
await connection.execute(todo_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])
|