lost track of changes...

This commit is contained in:
Ross
2023-01-09 09:52:09 +00:00
parent 9fc457c8a5
commit af52658e44
28 changed files with 469 additions and 118 deletions
+11
View File
@@ -116,6 +116,16 @@ def test_exams(db, client):
cid_user_2001 = CidUser.objects.get(cid=2001)
user1 = User.objects.get(username="user1")
# Test exam access urls
# Check that we can't access without logging in
assert client.get(exam.get_json_url()).status_code == 404
assert client.get(exam.get_json_url(cid=cid_user_2001.cid, passcode=cid_user_2001.passcode)).status_code == 404
# Valid user but incorrect passcode
assert client.get(exam.get_json_url(cid=cid_user_1001.cid, passcode=cid_user_2001.passcode)).status_code == 404
users_tested = 1
for cid_user in [cid_user_1001, cid_user_1000, user1]:
if isinstance(cid_user, CidUser):
@@ -168,6 +178,7 @@ def test_exams(db, client):
assert exam_metadata["exam_active"] == True
assert exam_metadata["exam_mode"] == True
# Check that we can access the exam json
res = client.get(exam_metadata["url"])
assert res.status_code == 200
exam_json = json.loads(res.content)