forked from pseudonym117/Riot-Watcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
126 lines (96 loc) · 2.94 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# these tests are pretty bad, mostly to make sure no exceptions are thrown
import time
from riotwatcher import RiotWatcher, NORTH_AMERICA
key = '<YOUR KEY HERE>'
# if summoner doesnt have ranked teams, teams tests will fail
# if summoner doesnt have ranked stats, stats tests will fail
# these are not graceful failures, so try to use a summoner that has them
summoner_name = 'YOUR NAME HERE'
w = RiotWatcher(key)
def wait():
while not w.can_make_request():
time.sleep(1)
def champion_tests():
wait()
temp = w.get_all_champions()
wait()
w.get_champion(temp['champions'][0]['id'])
def game_tests(summoner):
wait()
w.get_recent_games(summoner['id'])
def league_tests(summoner):
wait()
w.get_league(summoner_ids=[summoner['id'], ])
wait()
w.get_league_entry(summoner_ids=[summoner['id'], ])
wait()
w.get_challenger()
def static_tests():
temp = w.static_get_champion_list()
w.static_get_champion(temp['data'][list(temp['data'])[0]]['id'])
temp = w.static_get_item_list()
w.static_get_item(temp['data'][list(temp['data'])[0]]['id'])
temp = w.static_get_mastery_list()
w.static_get_mastery(temp['data'][list(temp['data'])[0]]['id'])
w.static_get_realm()
temp = w.static_get_rune_list()
w.static_get_rune(temp['data'][list(temp['data'])[0]]['id'])
temp = w.static_get_summoner_spell_list()
w.static_get_summoner_spell(temp['data'][list(temp['data'])[0]]['id'])
w.static_get_versions()
def status_tests():
w.get_server_status()
w.get_server_status(region=NORTH_AMERICA)
def match_tests(match):
wait()
w.get_match(match['matchId'])
def match_history_tests(summoner):
wait()
ms = w.get_match_history(summoner['id'])
return ms['matches'][0]
def stats_tests(summoner):
wait()
w.get_stat_summary(summoner['id'])
wait()
w.get_ranked_stats(summoner['id'])
def summoner_tests(summoner_name):
wait()
s = w.get_summoner(name=summoner_name)
wait()
w.get_summoner(_id=s['id'])
wait()
w.get_mastery_pages([s['id'], ])
wait()
w.get_rune_pages([s['id'], ])
wait()
w.get_summoner_name([s['id'], ])
return s
def team_tests(summoner):
wait()
t = w.get_teams_for_summoner(summoner['id'])
wait()
w.get_team(t[0]['fullId'])
def main():
static_tests()
print('static tests passed')
status_tests()
print('status tests passed')
champion_tests()
print('champion tests passed')
s = summoner_tests(summoner_name)
print('summoner tests passed')
game_tests(s)
print('game tests passed')
league_tests(s)
print('league tests passed')
stats_tests(s)
print('stats tests passed')
team_tests(s)
print('team tests passed')
m = match_history_tests(s)
print('match history tests passed')
match_tests(m)
print('match passed')
print('all tests passed, w00t. if only they were better tests...')
if __name__ == '__main__':
main()