Skip to content

Commit 8b92b42

Browse files
committed
fix: all elections unit tests pass
1 parent 0b0a228 commit 8b92b42

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/elections/urls.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,6 @@ async def update_registration(
533533
)
534534

535535
registration = await elections.crud.get_one_registration_in_election(db_session, computing_id, slugified_name, position)
536-
537536
if not registration:
538537
raise HTTPException(
539538
status_code=status.HTTP_404_NOT_FOUND,
@@ -632,7 +631,7 @@ async def get_nominee_info(
632631
detail="nominee doesn't exist"
633632
)
634633

635-
return JSONResponse(nominee_info)
634+
return JSONResponse(nominee_info.serialize())
636635

637636
@router.patch(
638637
"/nominee/{computing_id:str}",
@@ -695,4 +694,4 @@ async def provide_nominee_info(
695694
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
696695
detail="failed to get updated nominee"
697696
)
698-
return JSONResponse(nominee_info)
697+
return JSONResponse(nominee_info.serialize())

tests/integration/test_elections.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ async def test_endpoints_admin(client, database_setup):
267267

268268
# update the registration
269269
await client.patch(f"/elections/registration/{election_name}/vice-president/pkn4", json={
270-
"position": "president",
271270
"speech": "Vote for me as treasurer"
272271
})
273272
assert response.status_code == 200
@@ -284,19 +283,19 @@ async def test_endpoints_admin(client, database_setup):
284283
assert response.status_code == 200
285284

286285
# delete a registration
287-
response = await client.delete(f"/elections/registration/{election_name}/president")
286+
response = await client.delete(f"/elections/registration/{election_name}/president/jdo12")
288287
assert response.status_code == 200
289288

290289
# get nominee info
291-
response = await client.get("/elections/nominee/info")
290+
response = await client.get(f"/elections/nominee/{load_test_db.SYSADMIN_COMPUTING_ID}")
292291
assert response.status_code == 200
293292

294293
# update nominee info
295-
response = await client.put("/elections/nominee/info", json={
294+
response = await client.patch(f"/elections/nominee/{load_test_db.SYSADMIN_COMPUTING_ID}", json={
296295
"full_name": "Puneet N",
297296
"linked_in": "linkedin.com/not-my-linkedin",
298297
})
299298
assert response.status_code == 200
300299

301-
response = await client.get("/elections/nominee/info")
300+
response = await client.get(f"/elections/nominee/{load_test_db.SYSADMIN_COMPUTING_ID}")
302301
assert response.status_code == 200

0 commit comments

Comments
 (0)