mirror of
https://github.com/hydrosquall/tiingo-python.git
synced 2025-12-18 04:14:20 +01:00
Use vcr cassette fixtures in crypto tests
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
import vcr
|
||||
|
||||
from tiingo import TiingoClient
|
||||
|
||||
|
||||
@@ -12,13 +14,15 @@ class TestCryptoEndpoints(TestCase):
|
||||
def setUp(self):
|
||||
self._client = TiingoClient()
|
||||
|
||||
@vcr.user_cassette('tests/fixtures/crypto_metadata.yaml')
|
||||
def test_crypto_metadata(self):
|
||||
metadata = self._client.get_crypto_meta_data(ticker=['btcusd', 'fldcbtc'])
|
||||
metadata = self._client.get_crypto_metadata(ticker=['btcusd', 'fldcbtc'])
|
||||
|
||||
assert len(metadata) == 2
|
||||
assert metadata[0].ticker == 'btcusd'
|
||||
assert metadata[1].ticker == 'fldcbtc'
|
||||
|
||||
@vcr.use_cassette('tests/fixtures/crypto_top_of_book.yaml')
|
||||
def test_crypto_top_of_book(self):
|
||||
top_of_book = self._client.get_crypto_top_of_book(tickers=['btcusd', 'fldcbtc'],
|
||||
endDate='2018-01-02', includeRawExchangeData=True)
|
||||
@@ -26,10 +30,11 @@ class TestCryptoEndpoints(TestCase):
|
||||
assert len(top_of_book['topOfBookData']) == 2
|
||||
assert 'exchangeData' in top_of_book
|
||||
|
||||
@vcr.user_cassette('tests/fixtures/crypto_price_history.yaml')
|
||||
def test_crypto_price_history(self):
|
||||
price_history = self._client.get_crypto_price_history(tickers=['btcusd', 'fldcbtc'],
|
||||
startDate='2019-05-01', endDate='2019-05-02',
|
||||
includeRawExchangeData=True, resampleFreq='daily')
|
||||
includeRawExchangeData=True, resampleFreq='1day')
|
||||
assert len(price_history) == 2
|
||||
assert len(price_history[0]['priceData']) in [6, 7]
|
||||
assert 'exchangeData' in price_history[0]
|
||||
|
||||
Reference in New Issue
Block a user