diff --git a/tests/schemas/stocks/rh_news.schema b/tests/schemas/stocks/rh_news.schema index e4550b5..63a0b97 100644 --- a/tests/schemas/stocks/rh_news.schema +++ b/tests/schemas/stocks/rh_news.schema @@ -9,10 +9,13 @@ "summary": {"type":"string"}, "api_source": {"type":"string", "enum":["yahoo_finance", "seeking_alpha"]}, "updated_at": {"type":"string"}, - "instrument": {"type":"string", "format":"uri"} + "instrument": {"type":"string", "format":"uri"}, + "num_clicks": {"type":"integer"}, + "uuid": {"type":"null"} }, "requires": [ "url", "title", "source", "published_at", "author", - "summary", "api_source", "updated_at", "instrument"], + "summary", "api_source", "updated_at", "instrument", + "num_clicks", "uuid"], "additionalProperties": false } \ No newline at end of file diff --git a/tests/test_stocks_news.py b/tests/test_stocks_news.py index 1e32e7c..0ad6c98 100644 --- a/tests/test_stocks_news.py +++ b/tests/test_stocks_news.py @@ -177,6 +177,10 @@ class TestCompanyNewsRobinhood: """validate behavior for news.fetch_company_news_rh()""" good_ticker = helpers.CONFIG.get('STOCKS', 'good_ticker') bad_ticker = helpers.CONFIG.get('STOCKS', 'bad_ticker') + expected_news_cols = [ + 'api_source', 'author', 'instrument', 'num_clicks', 'published_at', + 'source', 'summary', 'title', 'updated_at', 'url', 'uuid' + ] @pytest.mark.long def test_default_happypath(self): @@ -225,11 +229,7 @@ def test_company_news_rh_happypath(self): assert isinstance(all_news_df, pandas.DataFrame) - expected_cols = [ - 'api_source', 'author', 'instrument', 'published_at', - 'source', 'summary', 'title', 'updated_at', 'url' - ] - assert list(all_news_df.columns.values) == expected_cols + assert list(all_news_df.columns.values) == self.expected_news_cols @pytest.mark.long def test_vader_application(self): @@ -239,10 +239,7 @@ def test_vader_application(self): graded_news = utils.vader_sentiment(all_news_df, 'title') - expected_cols = [ - 'api_source', 'author', 'instrument', 'published_at', - 'source', 'summary', 'title', 'updated_at', 'url', - 'neu', 'pos', 'compound', 'neg' - ] + expected_cols = self.expected_news_cols + expected_cols.extend(['neu', 'pos', 'compound', 'neg']) assert list(graded_news.columns.values) == expected_cols