Skip to content

Commit 1a7dea5

Browse files
authored
7 - Update game data api's
1 parent e21bcf3 commit 1a7dea5

File tree

10 files changed

+344
-75
lines changed

10 files changed

+344
-75
lines changed

.drone.yml

+24-5
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,43 @@
11
---
22
kind: pipeline
3-
name: default
3+
name: python27
44

55
steps:
6-
- name: build27
6+
- name: test
77
image: python:2.7-alpine3.8
88
commands:
99
- ./drone.sh
10+
- pytest -c pytest_legacy.ini
1011

11-
- name: build35
12+
---
13+
kind: pipeline
14+
name: python35
15+
16+
steps:
17+
- name: test
1218
image: python:3.5-alpine3.8
1319
commands:
1420
- ./drone.sh
21+
- pytest -c pytest_legacy.ini
22+
23+
---
24+
kind: pipeline
25+
name: python36
1526

16-
- name: build36
27+
steps:
28+
- name: test
1729
image: python:3.6-alpine3.8
1830
commands:
1931
- ./drone.sh
32+
- pytest
33+
34+
---
35+
kind: pipeline
36+
name: python37
2037

21-
- name: build37
38+
steps:
39+
- name: test
2240
image: python:3.7-alpine3.8
2341
commands:
2442
- ./drone.sh
43+
- pytest

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
* Bump requests library to 2.20.1
1515
* Change packaging with setup.py
1616

17-
## 2.1.0 (TBD)
17+
## 2.1.0 (13-12-2018)
1818

1919
* Add Game Data API methods
2020
* Token handling per region
21+
22+
## 2.2.0 (25-12-2018)
23+
24+
* Add new Game Data API's

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
tests:
5-
py.test -s -v tests
5+
pytest -s -v tests
66

77
devinstall:
88
pip install -e .

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,5 @@ api.get_data_resource('https://eu.api.blizzard.com/data/wow/connected-realm/509?
7272
```bash
7373
pip install -e .
7474
pip install -e .[tests]
75-
py.test
75+
pytest
7676
```

drone.sh

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
python setup.py sdist bdist_wheel
2-
rm -rf dist
3-
rm -rf build
1+
apk --update upgrade
2+
apk add make
3+
make build
44
pip install --upgrade pip
55
pip install -e .
66
pip install -e .[tests]
7-
py.test

pytest.ini

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
[pytest]
2-
addopts = -vs --tb=short --pep8 --flakes --cov=wowapi --cov-config .coveragerc
2+
addopts = -vs --tb=short --codestyle --cov=wowapi --cov-config .coveragerc
33

44
python_files =
55
test_*.py
66

7-
pep8maxlinelength = 99
8-
norecursedirs = env/* docs/*
7+
norecursedirs =
8+
env/*
9+
docs/*
910

10-
pep8ignore =
11-
docs/* ALL
12-
wowapi/__init__.py ALL
13-
14-
flakes-ignore =
15-
docs/* ALL
16-
tests/conftest.py ALL
11+
codestyle_max_line_length = 99
12+
codestyle_exclude =
13+
docs/*

pytest_legacy.ini

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[pytest]
2+
addopts = -vs --tb=short
3+
4+
python_files =
5+
test_*.py
6+
7+
norecursedirs =
8+
env/*
9+
docs/*

setup.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from setuptools import setup, find_packages
44

55

6-
__version__ = '2.1.0'
6+
__version__ = '2.2.0'
77

88

99
def read(*parts):
@@ -17,9 +17,8 @@ def read(*parts):
1717
]
1818

1919
test_requirements = [
20-
'pytest==4.0.1',
21-
'pytest-flakes==4.0.0',
22-
'pytest-pep8==1.0.6',
20+
'pytest==4.0.2',
21+
"pytest-pycodestyle ; python_version>'3.5'",
2322
'pytest-cov==2.6.0',
2423
'mock==2.0.0',
2524
'pytest-mock==1.10.0',

tests/test_api.py

+142-19
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,14 @@ def test_get_pet_types(self, response_mock):
323323
# Game Data API tests
324324
# ---------------------------------------------------------------------------------------------
325325

326+
# Connected Realm API
327+
326328
def test_get_connected_realms(self, response_mock):
327329
self.authorized_api.get_connected_realms('us', 'dynamic-us')
328330
params = copy.deepcopy(self.params)
329331
params['namespace'] = 'dynamic-us'
330332
response_mock.assert_called_with(
331-
'https://us.api.blizzard.com/data/wow/connected-realm/', params=params)
333+
'https://us.api.blizzard.com/data/wow/connected-realm/index', params=params)
332334

333335
def test_get_connected_realm(self, response_mock):
334336
self.authorized_api.get_connected_realm('us', 'dynamic-us', 1)
@@ -337,23 +339,23 @@ def test_get_connected_realm(self, response_mock):
337339
response_mock.assert_called_with(
338340
'https://us.api.blizzard.com/data/wow/connected-realm/1', params=params)
339341

340-
def test_get_mythic_keystone_leaderboards(self, response_mock):
341-
self.authorized_api.get_mythic_keystone_leaderboards('us', 'dynamic-us', 1)
342+
# Mythic Keystone Affix API
343+
344+
def test_get_mythic_keystone_affixes(self, response_mock):
345+
self.authorized_api.get_mythic_keystone_affixes('us', 'dynamic-us')
342346
params = copy.deepcopy(self.params)
343347
params['namespace'] = 'dynamic-us'
344348
response_mock.assert_called_with(
345-
'https://us.api.blizzard.com/data/wow/connected-realm/1/mythic-leaderboard/',
346-
params=params
347-
)
349+
'https://us.api.blizzard.com/data/wow/keystone-affix/index', params=params)
348350

349-
def test_get_mythic_keystone_leaderboard(self, response_mock):
350-
self.authorized_api.get_mythic_keystone_leaderboard('us', 'dynamic-us', 1, 2, 3)
351+
def test_get_mythic_keystone_affix(self, response_mock):
352+
self.authorized_api.get_mythic_keystone_affix('us', 'dynamic-us', 3)
351353
params = copy.deepcopy(self.params)
352354
params['namespace'] = 'dynamic-us'
353355
response_mock.assert_called_with(
354-
'https://us.api.blizzard.com/data/wow/connected-realm/1/mythic-leaderboard/2/period/3',
355-
params=params
356-
)
356+
'https://us.api.blizzard.com/data/wow/keystone-affix/3', params=params)
357+
358+
# Mythic Raid Leaderboard API
357359

358360
def test_get_mythic_raid_leaderboard(self, response_mock):
359361
self.authorized_api.get_mythic_raid_leaderboard('us', 'dynamic-us', 'uldir', 'horde')
@@ -364,21 +366,85 @@ def test_get_mythic_raid_leaderboard(self, response_mock):
364366
params=params
365367
)
366368

367-
def test_get_mythic_challenge_modes(self, response_mock):
368-
self.authorized_api.get_mythic_challenge_modes('us', 'dynamic-us')
369+
# Mythic Keystone Dungeon API
370+
371+
def test_get_mythic_keystone_dungeons(self, response_mock):
372+
self.authorized_api.get_mythic_keystone_dungeons('us', 'dynamic-us')
373+
params = copy.deepcopy(self.params)
374+
params['namespace'] = 'dynamic-us'
375+
response_mock.assert_called_with(
376+
'https://us.api.blizzard.com/data/wow/mythic-keystone/dungeon/index', params=params)
377+
378+
def test_get_mythic_keystone_dungeon(self, response_mock):
379+
self.authorized_api.get_mythic_keystone_dungeon('us', 'dynamic-us', 5)
380+
params = copy.deepcopy(self.params)
381+
params['namespace'] = 'dynamic-us'
382+
response_mock.assert_called_with(
383+
'https://us.api.blizzard.com/data/wow/mythic-keystone/dungeon/5', params=params)
384+
385+
def test_get_mythic_keystones(self, response_mock):
386+
self.authorized_api.get_mythic_keystones('us', 'dynamic-us')
387+
params = copy.deepcopy(self.params)
388+
params['namespace'] = 'dynamic-us'
389+
response_mock.assert_called_with(
390+
'https://us.api.blizzard.com/data/wow/mythic-keystone/index', params=params)
391+
392+
def test_get_mythic_keystone_periods(self, response_mock):
393+
self.authorized_api.get_mythic_keystone_periods('us', 'dynamic-us')
394+
params = copy.deepcopy(self.params)
395+
params['namespace'] = 'dynamic-us'
396+
response_mock.assert_called_with(
397+
'https://us.api.blizzard.com/data/wow/mythic-keystone/period/index', params=params)
398+
399+
def test_get_mythic_keystone_period(self, response_mock):
400+
self.authorized_api.get_mythic_keystone_period('us', 'dynamic-us', 641)
401+
params = copy.deepcopy(self.params)
402+
params['namespace'] = 'dynamic-us'
403+
response_mock.assert_called_with(
404+
'https://us.api.blizzard.com/data/wow/mythic-keystone/period/641', params=params)
405+
406+
def test_get_mythic_keystone_seasons(self, response_mock):
407+
self.authorized_api.get_mythic_keystone_seasons('us', 'dynamic-us')
408+
params = copy.deepcopy(self.params)
409+
params['namespace'] = 'dynamic-us'
410+
response_mock.assert_called_with(
411+
'https://us.api.blizzard.com/data/wow/mythic-keystone/season/index', params=params)
412+
413+
def test_get_mythic_keystone_season(self, response_mock):
414+
self.authorized_api.get_mythic_keystone_season('us', 'dynamic-us', 1)
415+
params = copy.deepcopy(self.params)
416+
params['namespace'] = 'dynamic-us'
417+
response_mock.assert_called_with(
418+
'https://us.api.blizzard.com/data/wow/mythic-keystone/season/1', params=params)
419+
420+
# Mythic Keystone Leaderboard API
421+
422+
def test_get_mythic_keystone_leaderboards(self, response_mock):
423+
self.authorized_api.get_mythic_keystone_leaderboards('us', 'dynamic-us', 1)
424+
params = copy.deepcopy(self.params)
425+
params['namespace'] = 'dynamic-us'
426+
response_mock.assert_called_with(
427+
'https://us.api.blizzard.com/data/wow/connected-realm/1/mythic-leaderboard/index',
428+
params=params
429+
)
430+
431+
def test_get_mythic_keystone_leaderboard(self, response_mock):
432+
self.authorized_api.get_mythic_keystone_leaderboard('us', 'dynamic-us', 1, 2, 3)
369433
params = copy.deepcopy(self.params)
370434
params['namespace'] = 'dynamic-us'
371435
response_mock.assert_called_with(
372-
'https://us.api.blizzard.com/data/wow/mythic-challenge-mode/',
436+
'https://us.api.blizzard.com/data/wow/connected-realm/1/mythic-leaderboard/2/period/3',
373437
params=params
374438
)
375439

440+
# Playable Class API
441+
376442
def test_get_playable_classes(self, response_mock):
377443
self.authorized_api.get_playable_classes('us', 'static-us')
378444
params = copy.deepcopy(self.params)
379445
params['namespace'] = 'static-us'
380446
response_mock.assert_called_with(
381-
'https://us.api.blizzard.com/data/wow/playable-class/',
447+
'https://us.api.blizzard.com/data/wow/playable-class/index',
382448
params=params
383449
)
384450

@@ -391,12 +457,23 @@ def test_get_playable_class(self, response_mock):
391457
params=params
392458
)
393459

460+
def test_get_playable_class_pvp_talent_slots(self, response_mock):
461+
self.authorized_api.get_playable_class_pvp_talent_slots('us', 'static-us', 7)
462+
params = copy.deepcopy(self.params)
463+
params['namespace'] = 'static-us'
464+
response_mock.assert_called_with(
465+
'https://us.api.blizzard.com/data/wow/playable-class/7/pvp-talent-slots',
466+
params=params
467+
)
468+
469+
# Playable Specialization API
470+
394471
def test_get_playable_specializations(self, response_mock):
395472
self.authorized_api.get_playable_specializations('us', 'static-us')
396473
params = copy.deepcopy(self.params)
397474
params['namespace'] = 'static-us'
398475
response_mock.assert_called_with(
399-
'https://us.api.blizzard.com/data/wow/playable-specialization/',
476+
'https://us.api.blizzard.com/data/wow/playable-specialization/index',
400477
params=params
401478
)
402479

@@ -409,12 +486,54 @@ def test_get_playable_specialization(self, response_mock):
409486
params=params
410487
)
411488

489+
# Power Type API
490+
491+
def test_get_power_types(self, response_mock):
492+
self.authorized_api.get_power_types('us', 'static-us')
493+
params = copy.deepcopy(self.params)
494+
params['namespace'] = 'static-us'
495+
response_mock.assert_called_with(
496+
'https://us.api.blizzard.com/data/wow/power-type/index',
497+
params=params
498+
)
499+
500+
def test_get_power_type(self, response_mock):
501+
self.authorized_api.get_power_type('us', 'static-us', 0)
502+
params = copy.deepcopy(self.params)
503+
params['namespace'] = 'static-us'
504+
response_mock.assert_called_with(
505+
'https://us.api.blizzard.com/data/wow/power-type/0',
506+
params=params
507+
)
508+
509+
# Playable Race API
510+
511+
def test_get_races(self, response_mock):
512+
self.authorized_api.get_races('us', 'static-us')
513+
params = copy.deepcopy(self.params)
514+
params['namespace'] = 'static-us'
515+
response_mock.assert_called_with(
516+
'https://us.api.blizzard.com/data/wow/race/index',
517+
params=params
518+
)
519+
520+
def test_get_race(self, response_mock):
521+
self.authorized_api.get_race('us', 'static-us', 2)
522+
params = copy.deepcopy(self.params)
523+
params['namespace'] = 'static-us'
524+
response_mock.assert_called_with(
525+
'https://us.api.blizzard.com/data/wow/race/2',
526+
params=params
527+
)
528+
529+
# Realm API
530+
412531
def test_get_realms(self, response_mock):
413532
self.authorized_api.get_realms('us', 'dynamic-us')
414533
params = copy.deepcopy(self.params)
415534
params['namespace'] = 'dynamic-us'
416535
response_mock.assert_called_with(
417-
'https://us.api.blizzard.com/data/wow/realm/',
536+
'https://us.api.blizzard.com/data/wow/realm/index',
418537
params=params
419538
)
420539

@@ -427,12 +546,14 @@ def test_get_realm(self, response_mock):
427546
params=params
428547
)
429548

549+
# Region API
550+
430551
def test_get_regions(self, response_mock):
431552
self.authorized_api.get_regions('us', 'dynamic-us')
432553
params = copy.deepcopy(self.params)
433554
params['namespace'] = 'dynamic-us'
434555
response_mock.assert_called_with(
435-
'https://us.api.blizzard.com/data/wow/region/',
556+
'https://us.api.blizzard.com/data/wow/region/index',
436557
params=params
437558
)
438559

@@ -445,9 +566,11 @@ def test_get_region(self, response_mock):
445566
params=params
446567
)
447568

569+
# WoW Token API
570+
448571
def test_get_token(self, response_mock):
449572
self.authorized_api.get_token('us', 'dynamic-us')
450573
params = copy.deepcopy(self.params)
451574
params['namespace'] = 'dynamic-us'
452575
response_mock.assert_called_with(
453-
'https://us.api.blizzard.com/data/wow/token/', params=params)
576+
'https://us.api.blizzard.com/data/wow/token/index', params=params)

0 commit comments

Comments
 (0)