@@ -31,8 +31,19 @@ class InstanceView(generics.RetrieveUpdateDestroyAPIView):
3131 authentication_classes = [authentication .BasicAuthentication ]
3232 permission_classes = [permissions .DjangoModelPermissions ]
3333
34+
35+ class GetQuerySetListView (generics .ListCreateAPIView ):
36+ serializer_class = BasicSerializer
37+ authentication_classes = [authentication .BasicAuthentication ]
38+ permission_classes = [permissions .DjangoModelPermissions ]
39+
40+ def get_queryset (self ):
41+ return BasicModel .objects .all ()
42+
43+
3444root_view = RootView .as_view ()
3545instance_view = InstanceView .as_view ()
46+ get_queryset_list_view = GetQuerySetListView .as_view ()
3647
3748
3849def basic_auth_header (username , password ):
@@ -67,6 +78,12 @@ def test_has_create_permissions(self):
6778 response = root_view (request , pk = 1 )
6879 self .assertEqual (response .status_code , status .HTTP_201_CREATED )
6980
81+ def test_get_queryset_has_create_permissions (self ):
82+ request = factory .post ('/' , {'text' : 'foobar' }, format = 'json' ,
83+ HTTP_AUTHORIZATION = self .permitted_credentials )
84+ response = get_queryset_list_view (request , pk = 1 )
85+ self .assertEqual (response .status_code , status .HTTP_201_CREATED )
86+
7087 def test_has_put_permissions (self ):
7188 request = factory .put ('/1' , {'text' : 'foobar' }, format = 'json' ,
7289 HTTP_AUTHORIZATION = self .permitted_credentials )
0 commit comments