mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Since we cannot depend on InnoDB features across all mysql installations, we are instead using this new column to track metadata changes for a particular package base. This will allow us to fetch less data when producing metadata archives for end-users, and it does not depend on installation details aside from the schema/migrations being applied. New columns: - `PackageBase`.`MetaModifiedTS` Signed-off-by: Kevin Morris <kevr@0cost.org>
49 lines
1,016 B
Python
49 lines
1,016 B
Python
import pytest
|
|
|
|
from aurweb import db
|
|
from aurweb.models import PackageBase, User
|
|
from aurweb.time import utcnow
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def setup(db_test: None) -> None:
|
|
pass
|
|
|
|
|
|
@pytest.fixture
|
|
def user() -> User:
|
|
|
|
with db.begin():
|
|
user_ = db.create(User, Username="test", Email="test@example.org")
|
|
|
|
yield user_
|
|
|
|
|
|
@pytest.fixture
|
|
def pkgbase(user: User) -> PackageBase:
|
|
now = utcnow()
|
|
|
|
with db.begin():
|
|
pkgbase_ = db.create(
|
|
PackageBase,
|
|
Name="pkg",
|
|
ModifiedTS=now,
|
|
MetaModifiedTS=now,
|
|
SubmittedTS=now,
|
|
Maintainer=user,
|
|
Packager=user,
|
|
)
|
|
|
|
yield pkgbase_
|
|
|
|
|
|
def test_package_base_columns(user: User, pkgbase: PackageBase):
|
|
assert pkgbase.Name == "pkg"
|
|
|
|
assert bool(pkgbase.SubmittedTS)
|
|
assert bool(pkgbase.ModifiedTS)
|
|
assert bool(pkgbase.MetaModifiedTS)
|
|
|
|
assert pkgbase.Maintainer == user
|
|
assert pkgbase.Packager == user
|
|
assert pkgbase.Flagger is None
|