Skip to content

Commit 916b735

Browse files
committed
Changed Runtime Exception to Exception in Test_API and added pytest.fail
to shelterluv tests per Cris's comments
1 parent 0522dfe commit 916b735

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/server/test_api.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def test_user_get_person_animal_events(state: State):
286286

287287
try:
288288
response = requests.get(url, headers = auth_hdr)
289-
except RuntimeError as err:
289+
except Exception as err:
290290
print(err)
291291
else:
292292
assert response.status_code == 200
@@ -310,7 +310,7 @@ def test_user_get_animals(state: State):
310310

311311
try:
312312
response = requests.get(url, headers = auth_hdr)
313-
except RuntimeError as err:
313+
except Exception as err:
314314
print(err)
315315
else:
316316
assert response.status_code == 200
@@ -324,6 +324,9 @@ def test_user_get_animals_sl_token(state: State):
324324
is present in the secrets_dict file.
325325
Note this works on the assumption the SL token is not valid, and returns
326326
a default empty value
327+
328+
>> This is tricky - if SL token is correct and person_id is valid, could get animal records returned.
329+
327330
"""
328331

329332
# Build auth string value including token from state
@@ -336,8 +339,9 @@ def test_user_get_animals_sl_token(state: State):
336339

337340
try:
338341
response = requests.get(url, headers = auth_hdr)
339-
except RuntimeError as err:
342+
except Exception as err:
340343
print(err)
344+
pytest.fail('test_user_get_animals_sl_token - Request failed', pytrace=False)
341345
else:
342346
assert response.status_code == 200
343347
assert response.json() == {'person_details': {}, 'animal_details': {}}
@@ -361,8 +365,9 @@ def test_user_get_person_animal_events_sl_token(state: State):
361365

362366
try:
363367
response = requests.get(url, headers = auth_hdr)
364-
except RuntimeError as err:
368+
except Exception as err:
365369
print(err)
370+
pytest.fail('test_user_get_person_animal_events_sl_token - Request failed', pytrace=False)
366371
else:
367372
assert response.status_code == 200
368373
assert response.json() == {}

0 commit comments

Comments
 (0)