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
incourse
- course(teacher, student)[source]¶
Fixture containing a
Course
objectThe name of the course is “Intro to OpenGL”, and the teacher is the same teacher as given by
teacher
and a student is fromstudent
- quiz_submission(quiz, student)[source]¶
Creates a
Submission
.The submission is for
quiz
and was submitted bystudent
. The submission text isprint('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 bystudent
. The submission text isprint('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