Пример #1
0
def test_locations_rankings_apicall_url():
    coc = ClashOfClans(bearer_token="fake_key", endpoint="http://endpoint", api_version="v0")
    apicall = coc.locations(123).rankings.clans
    assert 'locations' in apicall.uri_parts
    assert 123 in apicall.uri_parts
    assert 'rankings' in apicall.uri_parts
    assert 'clans' in apicall.uri_parts
    assert len(apicall.uri_parts) == 4
    
    apicall = coc.locations(123).rankings('clans')
    assert 'locations' in apicall.uri_parts
    assert 123 in apicall.uri_parts
    assert 'rankings' in apicall.uri_parts
    assert 'clans' in apicall.uri_parts
    assert len(apicall.uri_parts) == 4
    
    apicall = coc.locations(123).rankings.players
    assert 'locations' in apicall.uri_parts
    assert 123 in apicall.uri_parts
    assert 'rankings' in apicall.uri_parts
    assert 'players' in apicall.uri_parts
    assert len(apicall.uri_parts) == 4

    apicall = coc.locations(123).rankings('players')
    assert 'locations' in apicall.uri_parts
    assert 123 in apicall.uri_parts
    assert 'rankings' in apicall.uri_parts
    assert 'players' in apicall.uri_parts
    assert len(apicall.uri_parts) == 4
Пример #2
0
def test_build_uri():
    coc = ClashOfClans(bearer_token="fake_key", endpoint="http://endpoint", api_version="v0")
    apicall = coc.locations('123').rankings('players')
    built_uri = build_uri(coc.endpoint, coc.api_version, apicall.uri_parts)
    assert built_uri == 'http://endpoint/v0/locations/123/rankings/players'
    
    apicall = coc.locations('123').rankings.clans
    built_uri = build_uri(coc.endpoint, coc.api_version, apicall.uri_parts)
    assert built_uri == 'http://endpoint/v0/locations/123/rankings/clans'
Пример #3
0
def test_specific_locations_apicall(api_key):
    coc = ClashOfClans(bearer_token=api_key)
    r = coc.locations(32000260).get()
    assert r.status_code == 200
    assert isinstance(r, dict)
    assert r['countryCode'] == u'ZW'
    assert r['id'] == 32000260
    assert r['isCountry'] == True
    assert r['name'] == u'Zimbabwe'
Пример #4
0
def test_specific_locations_apicall(api_key):
    coc = ClashOfClans(bearer_token=api_key)
    r = coc.locations(32000260).get()
    assert r.status_code == 200
    assert isinstance(r, dict)
    assert r['countryCode'] == u'ZW'
    assert r['id'] == 32000260
    assert r['isCountry'] == True
    assert r['name'] == u'Zimbabwe'
Пример #5
0
def test_location_player_rank_apicall(api_key):
    coc = ClashOfClans(bearer_token=api_key)
    r = coc.locations(32000260).rankings.clans.get()
    assert r.status_code == 200
Пример #6
0
def test_location_player_rank_apicall(api_key):
    coc = ClashOfClans(bearer_token=api_key)
    r = coc.locations(32000260).rankings.clans.get()
    assert r.status_code == 200
Пример #7
0
from coc.api import ClashOfClans
from os import environ

if __name__ == '__main__':
    api = ClashOfClans(environ['COC_API_KEY'])
    print api.locations(32000183).get()
Пример #8
0
from coc.api import ClashOfClans
from os import environ


if __name__ == '__main__':
    api=ClashOfClans(environ['COC_API_KEY'])
    print api.locations(32000183).get()
Пример #9
0
def test_location_by_id_apicall_url():
    coc = ClashOfClans(bearer_token="fake_key", endpoint="http://endpoint", api_version="v0")
    apicall = coc.locations(123)
    assert 'locations' in apicall.uri_parts
    assert 123 in apicall.uri_parts
    assert len(apicall.uri_parts) == 2