Example #1
0
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"
Example #2
0
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)
Example #3
0
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"
Example #4
0
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"
Example #5
0
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"