Resolved unit test issue

This commit is contained in:
AuroraTradingTeam
2017-11-11 15:11:14 +00:00
parent 415fa6a22b
commit 60e2ce0379
5 changed files with 15 additions and 5 deletions
-3
View File
@@ -5,6 +5,3 @@
__author__ = """Gavin Chan"""
__email__ = 'gavincyi@gmail.com'
__version__ = '0.1.0'
__all__ = ['api']
from . import api
View File
+7 -2
View File
@@ -56,7 +56,9 @@ def get_coinlist():
"""
url = API_URL + "all/coinlist"
return requests.get(url).json()
r = requests.get(url)
r.raise_for_status()
return r.json()
def get_histo(period, fsym, tsym, e, limit=None, toTs=None):
@@ -94,6 +96,9 @@ def get_histo(period, fsym, tsym, e, limit=None, toTs=None):
# The api raises a 200 for a warning, but passes a message
rjson = r.json()
if rjson.get("Message", None):
logger.warning('api returned message %r, for url %r', rjson["Message"], r.url)
logger.warning(
'api returned message %r, for url %r',
rjson["Message"],
r.url)
return rjson
View File
+8
View File
@@ -54,6 +54,10 @@ def test_get_instruments_cryptocompare(monkeypatch):
}
}
@classmethod
def raise_for_status(cls):
pass
return MockReturnClass()
monkeypatch.setattr(requests, 'get', mockreturn)
@@ -129,6 +133,10 @@ def test_get_historical_prices_cryptocompare(monkeypatch):
}]
}
@classmethod
def raise_for_status(cls):
pass
return MockReturnClass()
monkeypatch.setattr(requests, 'get', mockreturn)