Skip to content

Commit

Permalink
🧪 tests: fix validate
Browse files Browse the repository at this point in the history
  • Loading branch information
ezeparziale committed Nov 6, 2024
1 parent ccfdd9e commit 740024e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
5 changes: 3 additions & 2 deletions app/tests/test_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def test_api_health(client: TestClient):
def validate(data):
return APIStatus(**data)

map(validate, res.json())
print(res.json())
data = res.json()
validate(data)
print(data)

assert res.status_code == 200
5 changes: 3 additions & 2 deletions app/tests/test_posts.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ def test_get_all_posts(authorized_client: TestClient, test_posts: list[Post]):
def validate(post):
return PostOut(**post)

map(validate, res.json())
print(res.json())
data = res.json()
[validate(item) for item in data]
print(data)

assert len(res.json()) == len(test_posts)
assert res.status_code == 200
Expand Down
11 changes: 7 additions & 4 deletions app/tests/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ def test_get_all_users(
def validate(user):
return UserOut(**user)

map(validate, res.json())
print(res.json())
data = res.json()
[validate(item) for item in data]
print(data)

assert res.status_code == 200

Expand Down Expand Up @@ -149,5 +150,7 @@ def test_get_user(
def validate(user):
return UserOut(**user)

map(validate, res.json())
print(res.json())
if res.status_code == 200:
data = res.json()
validate(data)
print(data)

0 comments on commit 740024e

Please sign in to comment.