diff --git a/tests/helpers.py b/tests/helpers.py index 61c8f503..7891d7b9 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -48,5 +48,6 @@ def __ne__(self, other: object) -> bool: return True -assert Missing() != Missing() +# ridiculous formatting because `ruff` won't allow `not (x == y)` +assert (Missing() == Missing()) ^ bool("x") assert Missing() != Missing() diff --git a/tests/migrations/revision_5410668e15ad.py b/tests/migrations/revision_5410668e15ad.py new file mode 100644 index 00000000..6971fd89 --- /dev/null +++ b/tests/migrations/revision_5410668e15ad.py @@ -0,0 +1,23 @@ +from hushline.db import db + + +class UpgradeTester: + def load_data(self) -> None: + pass # migration loads data itself + + def check_upgrade(self) -> None: + rows = list(db.session.execute(db.text("SELECT * FROM host_organization"))) + assert len(rows) == 1 + + row = rows[0]._asdict() + assert row["id"] == 1 + + +class DowngradeTester: + """Nothing to do. It's just a table drop.""" + + def load_data(self) -> None: + pass + + def check_downgrade(self) -> None: + pass