Skip to content

Commit

Permalink
feat: expose affiliate links to chat bot
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed Jan 31, 2024
1 parent e4a0820 commit 438aa79
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 7 additions & 3 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ def test_get_active_channels(client, mocker, requests_mock):
"legend_rank": 0,
"game_type": 1,
"twitch_user_id": 123,
"affiliate": "TheLichKing",
})

response = client.get(
Expand All @@ -371,7 +372,8 @@ def test_get_active_channels(client, mocker, requests_mock):
assert response.json() == [
{
"channel_login": "foo_bar",
"deck_url": deck_url
"deck_url": deck_url,
"affiliate": "TheLichKing",
}
]

Expand Down Expand Up @@ -440,7 +442,8 @@ def test_get_active_channels_with_cached_deck(client, mocker, requests_mock):
assert response.json() == [
{
"channel_login": "foo_bar",
"deck_url": deck_url
"deck_url": deck_url,
"affiliate": None,
}
]
mock_get_shortid_from_deck_list.assert_not_called()
Expand Down Expand Up @@ -493,7 +496,8 @@ def test_get_active_channels_for_bgs_game(client, mocker, requests_mock):
assert response.json() == [
{
"channel_login": "foo_bar",
"deck_url": None
"deck_url": None,
"affiliate": None,
}
]

Expand Down
5 changes: 4 additions & 1 deletion twitch_hdt_ebs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,12 @@ def get(self, request):
sideboard=deck_sideboards
) if deck_cards else None

affiliate = details.get("affiliate")

data.append({
"channel_login": channel_login,
"deck_url": deck_url
"deck_url": deck_url,
"affiliate": affiliate,
})

return Response(status=200, data=data)
Expand Down

0 comments on commit 438aa79

Please sign in to comment.