Skip to content

Commit

Permalink
Fix test_auth_environ_raises integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbourbeau committed Oct 17, 2023
1 parent d0386ae commit 709c10d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/integration/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ def test_auth_environ():


def test_auth_environ_raises(monkeypatch):
# Temporarily remove any existing authentication and make it so
# future attempts at authentication don't work
monkeypatch.setattr(earthaccess.__auth__, "authenticated", False)

def bad_login(*args, **kwargs):
raise RuntimeError("Can't login")

monkeypatch.setattr(earthaccess.Auth, "login", bad_login)

# Ensure `earthaccess.auth_environ()` raises an informative error
# when not authenticated
with pytest.raises(RuntimeError, match="authenticate"):
earthaccess.auth_environ()

0 comments on commit 709c10d

Please sign in to comment.