Skip to content
This repository was archived by the owner on Sep 7, 2024. It is now read-only.

Commit dd93aca

Browse files
Taur1neScrewTiny
andauthored
Add api test (#10)
* Correct gauntlet typo * Add ToA * Add new activities Pulled from https://runescape.wiki/w/Application_programming_interface#Old_School_Hiscores * Add new bosses Pulled from https://runescape.wiki/w/Application_programming_interface#Old_School_Hiscores * Add unittest for OSRS API * Rename validate_hiscore_api.py to test_hiscore_api.py * Fix typo Co-authored-by: taur1ne <cwongchot+github@gmail.com>
1 parent 10137bd commit dd93aca

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

osrs_api/const.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,19 @@ def _build_xp_table():
6464

6565
MINIGAMES = [
6666
"League Points",
67-
"Bounty Hunter",
68-
"Bounty Hunter Rogue",
67+
"Bounty Hunter - Hunter",
68+
"Bounty Hunter - Rogue",
6969
"Clue Scrolls (all)",
7070
"Clue Scrolls (beginner)",
7171
"Clue Scrolls (easy)",
7272
"Clue Scrolls (medium)",
7373
"Clue Scrolls (hard)",
7474
"Clue Scrolls (elite)",
7575
"Clue Scrolls (master)",
76-
"Last Man Standing",
76+
"LMS - Rank",
77+
"PvP Arena - Rank",
78+
"Soul Wars Zeal",
79+
"Rifts closed",
7780
]
7881

7982
BOSSES = [
@@ -104,14 +107,21 @@ def _build_xp_table():
104107
"Kree'Arra",
105108
"K'ril Tsutsaroth",
106109
"Mimic",
110+
"Nex",
111+
"Nightmare",
112+
"Phosani's Nightmare",
107113
"Obor",
108114
"Sarachnis",
109115
"Scorpia",
110116
"Skotizo",
111-
"The Guantlet",
112-
"The Corrupted Guantlet",
117+
"Tempoross",
118+
"The Gauntlet",
119+
"The Corrupted Gauntlet",
113120
"Theatre of Blood",
121+
"Theatre of Blood: Hard Mode",
114122
"Thermonuclear Smoke Devil",
123+
"Tombs of Amascut",
124+
"Tombs of Amascut: Expert Mode",
115125
"TzKal-Zuk",
116126
"TzTok-Jad",
117127
"Venenatis",

tests/test_hiscore_api.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import unittest
2+
3+
from osrs_api.hiscores import Hiscores
4+
from osrs_api.const import SKILLS_AMT, MINIGAMES_AMT, BOSSES_AMT
5+
6+
7+
class TestHiscore(unittest.TestCase):
8+
def test_api_length(self):
9+
"""Check to see if the API returns the same number of skills, minigames, and bosses that are mentioned in const.py. If this test fails, the items in const.py need to be updated."""
10+
score = Hiscores(username="Lelalt")
11+
expected_num_api_elements = SKILLS_AMT + MINIGAMES_AMT + BOSSES_AMT
12+
api_data = score._get_api_data()
13+
14+
# Remove empty string and overall values since they're not used
15+
len_api_data = len(api_data) - 2
16+
17+
self.assertEqual(expected_num_api_elements, len_api_data)

0 commit comments

Comments
 (0)