Refactor game ownership to support multiple organizations and update related logic

This commit is contained in:
Joakim Hellsén 2026-01-09 21:57:37 +01:00
commit 99e7b40535
No known key found for this signature in database
10 changed files with 99 additions and 64 deletions

View file

@ -64,12 +64,12 @@ class GameOwnerOrganizationTests(TestCase):
assert success is True
assert broken_dir is None
# Check game owner is Twitch Gaming, not Other Org
# Check game owners include Twitch Gaming and Other Org
game: Game = Game.objects.get(twitch_id="263490")
org: Organization = Organization.objects.get(twitch_id="d32de13d-937e-4196-8198-1a7f875f295a")
assert game.owner == org
assert game.owner
assert game.owner.name == "Twitch Gaming"
# Check both organizations exist
Organization.objects.get(twitch_id="other-org-id")
org1: Organization = Organization.objects.get(twitch_id="d32de13d-937e-4196-8198-1a7f875f295a")
org2: Organization = Organization.objects.get(twitch_id="other-org-id")
owners = list(game.owners.all())
assert org1 in owners
assert org2 in owners
assert any(o.name == "Twitch Gaming" for o in owners)
assert any(o.name == "Other Org" for o in owners)