Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fp12 committed Jan 12, 2017
1 parent 8521a43 commit ef7f811
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions challonge/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __init__(self, username: str, api_key: str, timeout, loop):
self.loop = loop

async def __call__(self, method: str, uri: str, params_prefix: str =None, **params):
""" responses codes:
""" response codes:
200 - OK
401 - Unauthorized (Invalid API key or insufficient permissions)
404 - Object not found within your account scope
Expand All @@ -90,8 +90,8 @@ async def __call__(self, method: str, uri: str, params_prefix: str =None, **para
auth = aiohttp.BasicAuth(login=self.username, password=self.api_key)
async with session.request(method, url, params=params, auth=auth) as response:
resp = await response.json()
assert_or_raise(response.status not in [401, 404, 406, 422, 500], APIException, uri, params, response.reason)
assert_or_raise(response.status == 200, ValueError, 'Unknown API return code', uri, params, response.reason)
assert_or_raise(response.status not in [401, 404, 406, 422, 500], APIException, response.status, response.reason, uri, params)
assert_or_raise(response.status == 200, ValueError, 'Unknown API return code', response.status, response.reason, uri, params)
return resp

@staticmethod
Expand Down
2 changes: 2 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def test_a_raise(self):
random_name = get_random_name()
t = yield from self.user.create_tournament(random_name, random_name)

challonge.USE_EXCEPTIONS = True

with self.assertRaises(NameError):
yield from t.update(fake_argument=0)

Expand Down

0 comments on commit ef7f811

Please sign in to comment.