Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
wh3248 committed Sep 20, 2023
1 parent 64326e1 commit d0c470c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/hf_hydrodata/gridded.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,8 @@ def _validate_user():
email, pin = get_registered_api_pin()
url_security = f"{HYDRODATA_URL}/api/api_pins?pin={pin}&email={email}"
response = requests.get(url_security, timeout=15)
if not response.status_code == 200:
raise ValueError(f"No registered PIN for email '{email}' and PIN {pin}. See documentation to register with a URL.")
json_string = response.content.decode("utf-8")
jwt_json = json.loads(json_string)
jwt_token = jwt_json["jwt_token"]
Expand Down
4 changes: 2 additions & 2 deletions tests/hf_hydrodata/test_gridded.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class MockResponse:
def __init__(self):
self.headers = {}
self.status_code = 200
self.content = b"test content"
self.content = b'{"email": "[email protected]", "jwt_token":"foo"}'
self.checksum = ""


def mock_requests_get(url, timeout):
def mock_requests_get(url, headers=None, timeout=5):
"""Create a mock streaming response."""

response = MockResponse()
Expand Down

0 comments on commit d0c470c

Please sign in to comment.