-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,12 @@ | |
class TestClassViewSet(ModelViewSetTestCase[RequestUser, Class]): | ||
basename = "class" | ||
model_view_set_class = ClassViewSet | ||
fixtures = ["school_1"] | ||
|
||
def setUp(self): | ||
self.admin_school_teacher_user = AdminSchoolTeacherUser.objects.get( | ||
email="[email protected]" | ||
) | ||
|
||
# test: get permissions | ||
|
||
|
@@ -81,3 +87,22 @@ def test_get_queryset__teacher__non_admin(self): | |
values=user.teacher.classes, | ||
request=self.client.request_factory.get(user=user), | ||
) | ||
|
||
# test: actions | ||
|
||
def test_retrieve(self): | ||
"""Can successfully retrieve a class.""" | ||
user = StudentUser.objects.first() | ||
assert user | ||
|
||
self.client.login_as(user, password="Password1") | ||
self.client.retrieve(model=user.student.class_field) | ||
|
||
def test_list(self): | ||
"""Can successfully list classes.""" | ||
user = self.admin_school_teacher_user | ||
# TODO: assert user has classes in new schema. | ||
assert user.teacher.classes.count() >= 2 | ||
|
||
self.client.login_as(user) | ||
self.client.list(models=user.teacher.classes.all()) |