Skip to content

Commit

Permalink
Change test exception catch
Browse files Browse the repository at this point in the history
  • Loading branch information
munrojm committed Sep 6, 2023
1 parent ee8ff1b commit ec82542
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from random import choice, randint
from typing import Any, Tuple
from urllib.parse import urlencode
import json

import pytest
from fastapi.encoders import jsonable_encoder
Expand Down Expand Up @@ -129,8 +130,8 @@ def search_helper(payload, base: str = "/?", debug=True) -> Tuple[Response, Any]
res = client.get(url)
try:
data = res.json().get("data", [])
except Exception:
data = res.reason
except json.decoder.JSONDecodeError:
data = res.text

return res, data

Expand Down

0 comments on commit ec82542

Please sign in to comment.