Skip to content

Commit

Permalink
Update raised exception for invalid server response
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeckman314 committed Mar 2, 2024
1 parent d4fa6e5 commit 8178eab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tes/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def check_success(data: Task) -> bool:
try:
response = self.get_task(task_id, "MINIMAL")
except Exception:
pass
raise Exception(f"Failed to get task {task_id}")

if response is not None:
if check_success(response):
Expand Down
12 changes: 12 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,18 @@ def test_wait(self):
)
self.cli.wait(self.mock_id, timeout=2)

def test_wait_exception(self):
with requests_mock.Mocker() as m:
m.get(
"%s/ga4gh/tes/v1/tasks/%s" % (self.mock_url, self.mock_id),
status_code=200,
json={
"Error": "Error",
}
)
with self.assertRaises(Exception):
self.cli.wait(self.mock_id, timeout=2)

def test_wait_no_state_change(self):
with requests_mock.Mocker() as m:
m.get(
Expand Down

0 comments on commit 8178eab

Please sign in to comment.