Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sammchardy committed Jun 19, 2018
1 parent 1da7cb8 commit 427a22b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tests/test_api_request.py
Expand Up @@ -6,15 +6,15 @@
import requests_mock


client = Client('api_key')
client = Client('api_key', 'api_secret')


def test_invalid_json():
"""Test Invalid response Exception"""

with pytest.raises(BigoneRequestException):
with requests_mock.mock() as m:
m.get('https://api.big.one/markets', text='<head></html>')
m.get('https://big.one/api/v2/markets', text='<head></html>')
client.get_markets()


Expand All @@ -24,11 +24,10 @@ def test_api_exception():
with pytest.raises(BigoneAPIException):
with requests_mock.mock() as m:
json_obj = {
'error': {
'status': 422,
'errors': [{
'code': 20102,
'description': 'Unsupported currency ABC'
}
'message': 'Unsupported currency ABC'
}]
}
m.get('https://api.big.one/accounts/ABC', json=json_obj, status_code=422)
m.get('https://big.one/api/v2/accounts/ABC', json=json_obj, status_code=422)
client.get_account('ABC')

0 comments on commit 427a22b

Please sign in to comment.