Test all Price Endpoints

This commit is contained in:
Cameron Yick
2017-08-25 01:11:57 -04:00
parent e2508c2dbb
commit 4dba25302a
2 changed files with 22 additions and 11 deletions

View File

@@ -63,8 +63,11 @@ Then, use the TiingoClient to make your API calls. (Other parameters are availab
# Get news articles about given tickers or search terms from given domains # Get news articles about given tickers or search terms from given domains
# Coming soon! # Coming soon!
Further Docs
--------
* Official Tiingo Documentation: https://api.tiingo.com * Official Tiingo Documentation: https://api.tiingo.com
* Tiingo-Pyhon Documentation (Under Construction): https://tiingo-python.readthedocs.io. * Tiingo-Python Documentation (Under Construction): https://tiingo-python.readthedocs.io.
Features Features
-------- --------

View File

@@ -9,18 +9,26 @@ from tiingo import TiingoClient
@pytest.fixture @pytest.fixture
def response(): def ticker_price_response():
"""Sample pytest fixture. """Test /tiingo/<ticker>/prices endpoint"""
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
t = TiingoClient() t = TiingoClient()
return t.get_ticker_price("GOOGL") return t.get_ticker_price("GOOGL")
# return requests.get('https://github.com/audreyr/cookiecutter-pypackage')
def test_content(response): @pytest.fixture
def ticker_metadata_response():
"""Test /tiingo/<ticker> endpoint"""
t = TiingoClient()
return t.get_ticker_metadata("GOOGL")
def test_ticker_price(ticker_price_response):
"""Sample pytest test function with the pytest fixture as an argument.""" """Sample pytest test function with the pytest fixture as an argument."""
# from bs4 import BeautifulSoup assert len(ticker_price_response) == 1
# assert 'GitHub' in BeautifulSoup(response.content).title.string assert ticker_price_response.get('adjClose')
assert len(response) > 0
def test_ticker_metadata(ticker_metadata_response):
"""Refactor this with python data schemavalidation"""
assert ticker_metadata_response.get('ticker') == "GOOGL"
assert ticker_metadata_response.get("name")