28
28
class TestUserViewSet (ModelViewSetTestCase [RequestUser , User ]):
29
29
basename = "user"
30
30
model_view_set_class = UserViewSet
31
- fixtures = ["non_school_teacher" , "school_1" ]
31
+ fixtures = ["non_school_teacher" , "school_1" , "independent" ]
32
32
33
33
def setUp (self ):
34
34
self .admin_school_teacher_user = AdminSchoolTeacherUser .objects .get (
@@ -160,7 +160,7 @@ def test_list__students_in_class(self):
160
160
filters = {"students_in_class" : klass .access_code },
161
161
)
162
162
163
- def test_list__only_teachers (self ):
163
+ def test_list__type__teacher (self ):
164
164
"""Can successfully list only teacher-users."""
165
165
user = self .admin_school_teacher_user
166
166
school_teacher_users = user .teacher .school_teacher_users .all ()
@@ -169,7 +169,31 @@ def test_list__only_teachers(self):
169
169
self .client .login_as (user )
170
170
self .client .list (
171
171
models = school_teacher_users ,
172
- filters = {"only_teachers" : str (True )},
172
+ filters = {"type" : "teacher" },
173
+ )
174
+
175
+ def test_list__type__student (self ):
176
+ """Can successfully list only student-users."""
177
+ user = self .admin_school_teacher_user
178
+ student_users = user .teacher .student_users .all ()
179
+ assert student_users .exists ()
180
+
181
+ self .client .login_as (user )
182
+ self .client .list (
183
+ models = student_users ,
184
+ filters = {"type" : "student" },
185
+ )
186
+
187
+ def test_list__type__indy (self ):
188
+ """Can successfully list only independent-users."""
189
+ user = self .admin_school_teacher_user
190
+ indy_users = user .teacher .indy_users .all ()
191
+ assert indy_users .exists ()
192
+
193
+ self .client .login_as (user )
194
+ self .client .list (
195
+ models = indy_users ,
196
+ filters = {"type" : "indy" },
173
197
)
174
198
175
199
def test_list___id (self ):
0 commit comments