mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-12 22:12:08 +00:00
feat: persist player-scoped assignments
This commit is contained in:
@@ -5,6 +5,7 @@ import unittest
|
||||
|
||||
|
||||
SQL = (Path(__file__).parent / "0001_initial.sql").read_text()
|
||||
ASSIGNMENTS_SQL = (Path(__file__).parent / "0002_assignments.sql").read_text()
|
||||
|
||||
|
||||
class MigrationTest(unittest.TestCase):
|
||||
@@ -43,6 +44,15 @@ class MigrationTest(unittest.TestCase):
|
||||
self.assertIn("REFERENCES identities(player_id)", SQL)
|
||||
self.assertIn("REFERENCES matches(match_id)", SQL)
|
||||
|
||||
def test_assignments_are_player_scoped_and_expiry_bound(self):
|
||||
for fragment in (
|
||||
"CREATE TABLE assignments", "PRIMARY KEY (match_id, player_id)",
|
||||
"FOREIGN KEY (match_id, player_id)", "UNIQUE (match_id, slot)",
|
||||
"join_authorisation TEXT NOT NULL", "expires_at TIMESTAMPTZ NOT NULL",
|
||||
"assignments_player_expiry",
|
||||
):
|
||||
self.assertIn(fragment, ASSIGNMENTS_SQL)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user