Skip to content

Commit

Permalink
added test for host_organization migration
Browse files Browse the repository at this point in the history
  • Loading branch information
brassy-endomorph committed Oct 5, 2024
1 parent 2ea86e8 commit 2166520
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
23 changes: 23 additions & 0 deletions tests/migrations/revision_5410668e15ad.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2166520

Please sign in to comment.