Skip to content

Commit

Permalink
Merge pull request #320 from jrbourbeau/test_auth_environ_raises-fixup
Browse files Browse the repository at this point in the history
Fix ``test_auth_environ_raises integration`` test
  • Loading branch information
jrbourbeau authored Oct 17, 2023
2 parents d0386ae + 234f9af commit 6fbc4ae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/integration/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ def test_auth_environ():


def test_auth_environ_raises(monkeypatch):
monkeypatch.setattr(earthaccess.__auth__, "authenticated", False)
# Ensure `earthaccess.__auth__` always returns a new,
# unauthenticated `earthaccess.Auth` instance, bypassing
# automatic auth behavior
monkeypatch.setattr(earthaccess, "__auth__", earthaccess.Auth())

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

0 comments on commit 6fbc4ae

Please sign in to comment.