issue #82: added tests

This commit is contained in:
Davis Thames
2018-04-13 09:51:58 -05:00
parent 47014cf62f
commit ef3597b083
2 changed files with 32 additions and 0 deletions

24
tests/fixtures/ticker_price_weekly.yaml vendored Normal file
View File

@@ -0,0 +1,24 @@
interactions:
- request:
body: null
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Authorization: [Token 0000000000000000000000000000000000000000]
Connection: [keep-alive]
Content-Type: [application/json]
User-Agent: [tiingo-python-client 0.5.0]
method: GET
uri: https://api.tiingo.com/tiingo/daily/GOOGL/prices?format=json&resampleFreq=weekly&startDate=2018-01-05&endDate=2018-01-19
response:
body: {string: '[{"date":"2018-01-05T00:00:00.000Z","close":1110.29,"high":1113.58,"low":1053.02,"open":1053.02,"volume":5889084,"adjClose":1110.29,"adjHigh":1113.58,"adjLow":1053.02,"adjOpen":1053.02,"adjVolume":5889084,"divCash":0.0,"splitFactor":1.0},{"date":"2018-01-12T00:00:00.000Z","close":1130.65,"high":1131.3,"low":1103.98,"open":1111.0,"volume":6529655,"adjClose":1130.65,"adjHigh":1131.3,"adjLow":1103.98,"adjOpen":1111.0,"adjVolume":6529655,"divCash":0.0,"splitFactor":1.0},{"date":"2018-01-19T00:00:00.000Z","close":1135.97,"high":1148.88,"low":1123.49,"open":1140.31,"volume":4470611,"adjClose":1135.97,"adjHigh":1148.88,"adjLow":1123.49,"adjOpen":1140.31,"adjVolume":4470611,"divCash":0.0,"splitFactor":1.0}]'}
headers:
Allow: ['GET, HEAD, OPTIONS']
Content-Length: ['708']
Content-Type: [application/json]
Date: ['Fri, 13 Apr 2018 14:46:47 GMT']
Server: [nginx/1.10.1]
Vary: ['Accept, Cookie']
X-Frame-Options: [SAMEORIGIN]
status: {code: 200, message: OK}
version: 1

View File

@@ -63,6 +63,14 @@ class TestTickerPrices(TestCase):
assert len(prices) == 1 assert len(prices) == 1
assert prices[0].get('adjClose') assert prices[0].get('adjClose')
@vcr.use_cassette('tests/fixtures/ticker_price_weekly.yaml')
def test_ticker_price(self):
"""Test that EOD Prices Endpoint works"""
prices = self._client.get_ticker_price("GOOGL", startDate='2018-01-05',
endDate='2018-01-19', frequency='weekly')
assert len(prices) == 3
assert prices[0].get('adjClose')
@vcr.use_cassette('tests/fixtures/ticker_price.yaml') @vcr.use_cassette('tests/fixtures/ticker_price.yaml')
def test_ticker_price_as_object(self): def test_ticker_price_as_object(self):
"""Test that EOD Prices Endpoint works""" """Test that EOD Prices Endpoint works"""