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