Updated backend tests with new courts
This commit is contained in:
@@ -44,7 +44,9 @@ async def test_manage_teams(
|
||||
|
||||
# Verify the teams are actually in the first match
|
||||
first_match = final_matches[0]
|
||||
print(first_match)
|
||||
assert first_match["p1_team_id"] is not None
|
||||
assert first_match["p2_team_id"] is not None
|
||||
|
||||
p1_name = first_match["p1_team_id"]
|
||||
p2_name = first_match["p2_team_id"]
|
||||
|
||||
@@ -60,21 +62,21 @@ async def test_manage_courts(
|
||||
)
|
||||
t_id = res.json()["id"]
|
||||
|
||||
# Get initial courts
|
||||
# 1. Get initial courts from the tournament detail
|
||||
courts_res = await client.get(f"/tournaments/{t_id}")
|
||||
initial_courts = courts_res.json()["courts"]
|
||||
assert len(initial_courts) == 2
|
||||
|
||||
# Delete
|
||||
court_id = initial_courts[0]["id"]
|
||||
del_res = await client.delete(
|
||||
f"/tournaments/{t_id}/courts/{court_id}", headers=auth_headers
|
||||
)
|
||||
# 2. Extract the ID from the list so the variable is defined!
|
||||
court_to_delete_id = initial_courts[0]["id"]
|
||||
|
||||
# 3. Now use that variable in your delete call
|
||||
del_res = await client.delete(f"/courts/{court_to_delete_id}", headers=auth_headers)
|
||||
assert del_res.status_code == 200
|
||||
|
||||
# Create
|
||||
# CREATE: Change this from a tournament-specific route to the global one
|
||||
create_res = await client.post(
|
||||
f"/tournaments/{t_id}/courts", json={"name": "New Court"}, headers=auth_headers
|
||||
"/courts", json={"name": "New Court"}, headers=auth_headers # GLOBAL ROUTE
|
||||
)
|
||||
assert create_res.status_code == 200
|
||||
assert create_res.json()["name"] == "New Court"
|
||||
|
||||
Reference in New Issue
Block a user