fixtures

Functions

admin(django_user_model)[source]

Fixture to pass in an Admin user into a test

def test_admin_user(admin):
    assert admin.is_superuser
admin_login(client)[source]

Convenience fixture for logging in as admin.

Use the decorator login to save writing

@login("admin")
def test_redirect(client, course):
    response = client.get(reverse("assignments:edit", args=[course.id]))
    assert response.status_code != 302
assignment(course)[source]

Creates an Assignment in course

course(teacher, student)[source]

Fixture containing a Course object

The name of the course is “Intro to OpenGL”, and the teacher is the same teacher as given by teacher and a student is from student

create_users()[source]
quiz(assignment)[source]

Creates a quiz in course

quiz_submission(quiz, student)[source]

Creates a Submission.

The submission is for quiz and was submitted by student. The submission text is print('Hello World!').

student(django_user_model)[source]

Fixture to pass in a Student user into a test

def test_student_sees_assignment(student):
    # check if student user can see assignment
student_login(client)[source]

Convenience decorator for logging in as a teacher

Use the decorator login to save writing

@login("student")
def test_redirect(client, course):
    response = client.get(reverse("assignments:edit", args=[course.id]))
    assert response.status_code == 302
submission(assignment, student)[source]

Creates a Submission.

The submission is for assignment and was submitted by student. The submission text is print('Hello World!').

teacher(django_user_model)[source]

Fixture to pass in a Teacher user into a test

def test_create_assignment(teacher):
    # create assignment using a teacher User
teacher_login(client)[source]

Convenience fixture for logging in as a teacher

Use the decorator login to save writing

@login("teacher")
def test_redirect(client, course):
    response = client.get(reverse("assignments:edit", args=[course.id]))
    assert response.status_code != 302
tin_setup(settings, worker_id: str, testrun_uid: str)[source]

Set up the users and MEDIA_ROOTs for each test.