def test_verify_assignment__assignment_doesnt_exist(client, rf): req = rf.get("/test") resp = verify_assignment(req, "validation", 0) assert resp.status_code == 400 assert resp.template_name == "400.html"
def test_verify_assignment(client, rf, student_group_assignment, teacher): req = rf.get("/test") req.user = teacher.user student_group_assignment.group.teacher.add(teacher) resp = verify_assignment(req, "validation", student_group_assignment.pk) assert isinstance(resp, Quality)
def test_verify_assignment__teacher_doesnt_exist( client, rf, student_group_assignment, user ): req = rf.get("/test") req.user = user resp = verify_assignment(req, "validation", student_group_assignment.pk) assert resp.status_code == 403 assert resp.template_name == "403.html"
def test_verify_assignment__teacher_doesnt_have_access( client, rf, student_group_assignment, teacher): req = rf.get("/test") req.user = teacher.user student_group_assignment.group.teacher.remove(teacher) resp = verify_assignment(req, "validation", student_group_assignment.pk) assert resp.status_code == 403 assert resp.template_name == "403.html"
def test_verify_assignment__use_type_doesnt_exist( client, rf, student_group_assignment, teacher ): req = rf.get("/test") req.user = teacher.user student_group_assignment.group.teacher.add(teacher) resp = verify_assignment(req, "fake", student_group_assignment.pk) assert resp.status_code == 400 assert resp.template_name == "400.html"