aurweb/test/test_initdb.py
moson 141dccbfd9
feat: Switch to postgres
Migrate from MariaDB to PostgreSQL.

Signed-off-by: moson <moson@archlinux.org>
2023-12-12 19:24:56 +01:00

28 lines
599 B
Python

import pytest
import aurweb.config
import aurweb.db
import aurweb.initdb
from aurweb.models.account_type import AccountType
@pytest.fixture(autouse=True)
def setup(db_test):
return
class Args:
use_alembic = True
verbose = True
def test_run():
from aurweb.schema import metadata
aurweb.db.kill_engine()
metadata.drop_all(aurweb.db.get_engine(), checkfirst=False)
aurweb.initdb.run(Args())
# Check that constant table rows got added via initdb.
record = aurweb.db.query(AccountType, AccountType.AccountType == "User").first()
assert record is not None