Refactor game ownership to support multiple organizations and update related logic
This commit is contained in:
parent
df2941cdbc
commit
99e7b40535
10 changed files with 99 additions and 64 deletions
|
|
@ -27,8 +27,8 @@ class RSSFeedTestCase(TestCase):
|
|||
slug="test-game",
|
||||
name="Test Game",
|
||||
display_name="Test Game",
|
||||
owner=self.org,
|
||||
)
|
||||
self.game.owners.add(self.org)
|
||||
self.campaign = DropCampaign.objects.create(
|
||||
twitch_id="test-campaign-123",
|
||||
name="Test Campaign",
|
||||
|
|
@ -87,8 +87,8 @@ class RSSFeedTestCase(TestCase):
|
|||
slug="other-game",
|
||||
name="Other Game",
|
||||
display_name="Other Game",
|
||||
owner=self.org,
|
||||
)
|
||||
other_game.owners.add(self.org)
|
||||
DropCampaign.objects.create(
|
||||
twitch_id="other-campaign-123",
|
||||
name="Other Campaign",
|
||||
|
|
@ -120,8 +120,8 @@ class RSSFeedTestCase(TestCase):
|
|||
slug="other-game-2",
|
||||
name="Other Game 2",
|
||||
display_name="Other Game 2",
|
||||
owner=other_org,
|
||||
)
|
||||
other_game.owners.add(other_org)
|
||||
DropCampaign.objects.create(
|
||||
twitch_id="other-campaign-456",
|
||||
name="Other Campaign 2",
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ class TestSearchView:
|
|||
twitch_id="456",
|
||||
name="test_game",
|
||||
display_name="Test Game",
|
||||
owner=org,
|
||||
)
|
||||
game.owners.add(org)
|
||||
campaign: DropCampaign = DropCampaign.objects.create(
|
||||
twitch_id="789",
|
||||
name="Test Campaign",
|
||||
|
|
@ -246,8 +246,8 @@ class TestChannelListView:
|
|||
twitch_id="game1",
|
||||
name="test_game",
|
||||
display_name="Test Game",
|
||||
owner=org,
|
||||
)
|
||||
game.owners.add(org)
|
||||
|
||||
# Create a channel
|
||||
channel: Channel = Channel.objects.create(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue