Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clues hiscores #16

Merged
merged 2 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pyosrs/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ class GAME_MODE(Enum):
}

CLUES_INDEX: Final[Dict[int, Tuple[str, str]]] = {
29: ("clue_scrolls_all", "Clue Scrolls All"),
30: ("clue_scrolls_beginner", "Clue Scrolls Beginner"),
31: ("clue_scrolls_easy", "Clue Scrolls Easy"),
32: ("clue_scrolls_medium", "Clue Scrolls Medium"),
33: ("clue_scrolls_hard", "Clue Scrolls Hard"),
34: ("clue_scrolls_elite", "Clue Scrolls Elite"),
35: ("clue_scrolls_master", "Clue Scrolls Master"),
29: ("all", "Clue Scrolls All"),
30: ("beginner", "Clue Scrolls Beginner"),
31: ("easy", "Clue Scrolls Easy"),
32: ("medium", "Clue Scrolls Medium"),
33: ("hard", "Clue Scrolls Hard"),
34: ("elite", "Clue Scrolls Elite"),
35: ("master", "Clue Scrolls Master"),
}

BOSSES_INDEX: Final[Dict[int, Tuple[str, str]]] = {
Expand Down
24 changes: 24 additions & 0 deletions tests/pyosrs/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,30 @@ async def test_get_hiscore():
assert iron_hyger.combat_level == 126


@pytest.mark.asyncio
async def test_clues_hiscore():
hiscore_mock["get_hiscore"].mock(
side_effect=[
httpx.Response(
status_code=200, text=testing.api_responses.LYNX_TITAN_RESPONSE
)
]
)
async with hiscore_mock:
async with Pyosrs() as client:
lynx_titan = await client.get_hiscore("Lynx Titan")

assert lynx_titan.clues.dict() == {
"all": {"rank": 751176, "score": 22},
"beginner": {"rank": -1, "score": -1},
"easy": {"rank": -1, "score": -1},
"medium": {"rank": -1, "score": -1},
"hard": {"rank": 472813, "score": 22},
"elite": {"rank": -1, "score": -1},
"master": {"rank": -1, "score": -1},
}


@pytest.mark.asyncio
async def test_get_hiscore_with_invalid_username():
async with hiscore_mock:
Expand Down
Loading