Skip to content

Commit

Permalink
test cmc invalid key error
Browse files Browse the repository at this point in the history
  • Loading branch information
chadsr committed May 27, 2024
1 parent d460d9e commit db9933d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_waybar_crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
DEFAULT_DISPLAY_OPTIONS_FORMAT,
DEFAULT_XDG_CONFIG_HOME_PATH,
XDG_CONFIG_HOME_ENV,
CoinmarketcapApiException,
Config,
NoApiKeyException,
ResponseQuotesLatest,
Expand Down Expand Up @@ -274,6 +275,13 @@ def test_get_coinmarketcap_latest(self, waybar_crypto: WaybarCrypto):
assert field in quote_values
assert isinstance(quote_values[field], field_type)

@mock.patch.dict(os.environ, {API_KEY_ENV: ""})
def test_get_coinmarketcap_latest_invalid_key(self, waybar_crypto: WaybarCrypto):
try:
_ = waybar_crypto.coinmarketcap_latest()
except Exception as e:
assert isinstance(e, CoinmarketcapApiException)

def test_waybar_output(self, waybar_crypto: WaybarCrypto, quotes_latest: ResponseQuotesLatest):
output = waybar_crypto.waybar_output(quotes_latest)
assert isinstance(output, dict)
Expand Down

0 comments on commit db9933d

Please sign in to comment.