From 4dba25302a059458d4c428de6e0b2bb869d10de1 Mon Sep 17 00:00:00 2001 From: Cameron Yick Date: Fri, 25 Aug 2017 01:11:57 -0400 Subject: [PATCH] Test all Price Endpoints --- README.rst | 5 ++++- tests/test_tiingo.py | 28 ++++++++++++++++++---------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/README.rst b/README.rst index 1675a9b..6fc001a 100644 --- a/README.rst +++ b/README.rst @@ -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 # Coming soon! +Further Docs +-------- + * 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 -------- diff --git a/tests/test_tiingo.py b/tests/test_tiingo.py index 47b5641..783fa86 100644 --- a/tests/test_tiingo.py +++ b/tests/test_tiingo.py @@ -9,18 +9,26 @@ from tiingo import TiingoClient @pytest.fixture -def response(): - """Sample pytest fixture. - - See more at: http://doc.pytest.org/en/latest/fixture.html - """ +def ticker_price_response(): + """Test /tiingo//prices endpoint""" t = TiingoClient() 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/ 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.""" - # from bs4 import BeautifulSoup - # assert 'GitHub' in BeautifulSoup(response.content).title.string - assert len(response) > 0 + assert len(ticker_price_response) == 1 + assert ticker_price_response.get('adjClose') + + +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")