23 lines
728 B
Python
23 lines
728 B
Python
|
|
"""Bekrefter selve test-riggen fungerer: pool kan opprettes mot scratch-
|
||
|
|
databasen, og migrasjonene har faktisk kjørt (organization-tabellen finnes
|
||
|
|
og er tom)."""
|
||
|
|
|
||
|
|
from tests.conftest import create_org
|
||
|
|
|
||
|
|
|
||
|
|
async def test_pool_connects_and_schema_exists(pool):
|
||
|
|
from app import db as app_db
|
||
|
|
|
||
|
|
async with app_db.plain_connection() as conn:
|
||
|
|
count = await conn.fetchval("SELECT count(*) FROM organization")
|
||
|
|
assert count == 0
|
||
|
|
|
||
|
|
|
||
|
|
async def test_can_insert_via_helper(pool):
|
||
|
|
from app import db as app_db
|
||
|
|
|
||
|
|
org_id = await create_org()
|
||
|
|
async with app_db.org_connection(org_id) as conn:
|
||
|
|
row = await conn.fetchrow("SELECT name FROM organization WHERE id = $1", org_id)
|
||
|
|
assert row is not None
|