Adjust cli tests for new quotes list output

kivy_mainline_and_py3.8
Tyler Goodlet 2018-12-01 16:13:15 -05:00
parent 7378a16b90
commit 2df5c76828
1 changed files with 7 additions and 7 deletions

View File

@ -18,11 +18,11 @@ def run(cmd, *args):
return cp return cp
def verify_keys(tickers, quotes_dict): def verify_keys(tickers, quotes):
"""Verify all ticker names are keys in ``quotes_dict``. """Verify all ticker names are keys in ``quotes_dict``.
""" """
for key, quote in quotes_dict.items(): for quote in quotes:
assert key in tickers assert quote['key'] in tickers
@pytest.fixture @pytest.fixture
@ -39,8 +39,8 @@ def test_known_quotes(capfd, nyse_tickers):
# verify output can be parsed as json # verify output can be parsed as json
out, err = capfd.readouterr() out, err = capfd.readouterr()
quotes_dict = json.loads(out) quotes = json.loads(out)
verify_keys(nyse_tickers, quotes_dict) verify_keys(nyse_tickers, quotes)
@pytest.mark.parametrize( @pytest.mark.parametrize(
@ -61,8 +61,8 @@ def test_quotes_ticker_not_found(
out, err = capfd.readouterr() out, err = capfd.readouterr()
if out: if out:
# verify output can be parsed as json # verify output can be parsed as json
quotes_dict = json.loads(out) quotes = json.loads(out)
verify_keys(tickers, quotes_dict) verify_keys(tickers, quotes)
# check for warning log message when some quotes are found # check for warning log message when some quotes are found
warnmsg = f'Could not find symbol {bad_ticker[0]}' warnmsg = f'Could not find symbol {bad_ticker[0]}'
assert warnmsg in err assert warnmsg in err