Skip to content

Commit

Permalink
add tests for making sure approvecodes are not given out unless alrea…
Browse files Browse the repository at this point in the history
…dy known, fixes #96
  • Loading branch information
rambo committed Feb 26, 2024
1 parent e671536 commit 13d4f8e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ async def test_list_as_adm(tilauspalvelu_jwt_admin_client: TestClient) -> None:
resp_dict: Dict[Any, Any] = resp.json()
LOGGER.debug(resp_dict)
assert resp_dict["callsign_list"] is not None
assert resp_dict["callsign_list"][0]["callsign"]
assert not resp_dict["callsign_list"][0]["approvecode"]
assert resp.status_code == 200


Expand Down Expand Up @@ -528,6 +530,13 @@ async def test_enroll_with_invite_code( # pylint: disable=R0915
enrique_jwt = resp_dict["jwt"]
enrique_ac = resp_dict["approvecode"]

# list enrollments filter by code
resp = await tilauspalvelu_jwt_admin_client.get("/api/v1/enrollment/list", params={"code": enrique_ac})
resp_dict = resp.json()
assert resp_dict["callsign_list"] is not None
assert resp_dict["callsign_list"][0]["callsign"] == "enrollenrique"
assert resp_dict["callsign_list"][0]["approvecode"] == enrique_ac

# ENROLL WITH INVITE CODE - BAD CODE
json_dict = {"invite_code": "nosuchcode123", "callsign": "asdasds"}
resp = await unauth_client.post("/api/v1/enrollment/invitecode/enroll", json=json_dict)
Expand Down

0 comments on commit 13d4f8e

Please sign in to comment.