From ef3597b0838cb32d7edbac7bae44123c68680d8b Mon Sep 17 00:00:00 2001
From: Davis Thames
Date: Fri, 13 Apr 2018 09:51:58 -0500
Subject: [PATCH] issue #82: added tests
---
tests/fixtures/ticker_price_weekly.yaml | 24 ++++++++++++++++++++++++
tests/test_tiingo.py | 8 ++++++++
2 files changed, 32 insertions(+)
create mode 100644 tests/fixtures/ticker_price_weekly.yaml
diff --git a/tests/fixtures/ticker_price_weekly.yaml b/tests/fixtures/ticker_price_weekly.yaml
new file mode 100644
index 0000000..d4371e5
--- /dev/null
+++ b/tests/fixtures/ticker_price_weekly.yaml
@@ -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
diff --git a/tests/test_tiingo.py b/tests/test_tiingo.py
index 795285e..0b180a6 100644
--- a/tests/test_tiingo.py
+++ b/tests/test_tiingo.py
@@ -63,6 +63,14 @@ class TestTickerPrices(TestCase):
assert len(prices) == 1
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')
def test_ticker_price_as_object(self):
"""Test that EOD Prices Endpoint works"""