Skip to content

Commit

Permalink
Update Tests for Spectator-V5
Browse files Browse the repository at this point in the history
  • Loading branch information
geozukunft authored and pseudonym117 committed Apr 9, 2024
1 parent 6e008b5 commit f11b0e6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SpectatorApiV4
SpectatorApiV5
==============

.. py:currentmodule:: riotwatcher
.. autoclass:: riotwatcher._apis.league_of_legends.SpectatorApiV4
.. autoclass:: riotwatcher._apis.league_of_legends.SpectatorApiV5
:members:
:undoc-members:
2 changes: 1 addition & 1 deletion docs/riotwatcher/LeagueOfLegends/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ All APIs
LolStatusApiV4.rst
MatchApiV5.rst
ChallengesApiV1.rst
SpectatorApiV4.rst
SpectatorApiV5.rst
SummonerApiV4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@

import pytest

from riotwatcher._apis.league_of_legends import SpectatorApiV4
from riotwatcher._apis.league_of_legends import SpectatorApiV5


@pytest.mark.lol
@pytest.mark.unit
class TestSpectatorApiV4:
class TestSpectatorApiV5:
def test_by_summoner(self):
mock_base_api = MagicMock()
expected_return = object()
mock_base_api.raw_request.return_value = expected_return

spectator = SpectatorApiV4(mock_base_api)
spectator = SpectatorApiV5(mock_base_api)
region = "agagd"
encrypted_summoner_id = "98532"
encrypted_puuid = "98532"

ret = spectator.by_summoner(region, encrypted_summoner_id)
ret = spectator.by_summoner(region, encrypted_puuid)

mock_base_api.raw_request.assert_called_once_with(
SpectatorApiV4.__name__,
SpectatorApiV5.__name__,
spectator.by_summoner.__name__,
region,
f"https://{region}.api.riotgames.com/lol/spectator/v4/active-games/by-summoner/{encrypted_summoner_id}",
f"https://{region}.api.riotgames.com/lol/spectator/v5/active-games/by-summoner/{encrypted_puuid}",
{},
)

Expand All @@ -34,16 +34,16 @@ def test_featured_games(self):
expected_return = object()
mock_base_api.raw_request.return_value = expected_return

spectator = SpectatorApiV4(mock_base_api)
spectator = SpectatorApiV5(mock_base_api)
region = "hfh42"

ret = spectator.featured_games(region)

mock_base_api.raw_request.assert_called_once_with(
SpectatorApiV4.__name__,
SpectatorApiV5.__name__,
spectator.featured_games.__name__,
region,
f"https://{region}.api.riotgames.com/lol/spectator/v4/featured-games",
f"https://{region}.api.riotgames.com/lol/spectator/v5/featured-games",
{},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
"pbe1",
],
)
class TestSpectatorApiV4:
@pytest.mark.parametrize("encrypted_summoner_id", ["12345", "99999999999999999"])
def test_by_summoner(self, lol_context, region, encrypted_summoner_id):
class TestSpectatorApiV5:
@pytest.mark.parametrize("encrypted_puuid", ["12345", "99999999999999999"])
def test_by_summoner(self, lol_context, region, encrypted_puuid):
actual_response = lol_context.watcher.spectator.by_summoner(
region, encrypted_summoner_id
region, encrypted_puuid
)

lol_context.verify_api_call(
region,
f"/lol/spectator/v4/active-games/by-summoner/{encrypted_summoner_id}",
f"/lol/spectator/v5/active-games/by-summoner/{encrypted_puuid}",
{},
actual_response,
)
Expand All @@ -39,5 +39,5 @@ def test_featured_games(self, lol_context, region):
actual_response = lol_context.watcher.spectator.featured_games(region)

lol_context.verify_api_call(
region, "/lol/spectator/v4/featured-games", {}, actual_response
region, "/lol/spectator/v5/featured-games", {}, actual_response
)

0 comments on commit f11b0e6

Please sign in to comment.