mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
IMPORTANT: This test completely wipes out the database it's using. Make sure you've got AUR_CONFIG set to a test database configuration! Signed-off-by: Kevin Morris <kevr@0cost.org>
27 lines
630 B
Python
27 lines
630 B
Python
import pytest
|
|
|
|
import aurweb.config
|
|
import aurweb.db
|
|
import aurweb.initdb
|
|
|
|
from aurweb.models.account_type import AccountType
|
|
from aurweb.schema import metadata
|
|
from aurweb.testing import setup_test_db
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def setup():
|
|
setup_test_db()
|
|
|
|
tables = metadata.tables.keys()
|
|
for table in tables:
|
|
aurweb.db.session.execute(f"DROP TABLE IF EXISTS {table}")
|
|
|
|
|
|
def test_run():
|
|
class Args:
|
|
use_alembic = True
|
|
verbose = False
|
|
aurweb.initdb.run(Args())
|
|
assert aurweb.db.session.query(AccountType).filter(
|
|
AccountType.AccountType == "User").first() is not None
|