@@ -31,8 +31,19 @@ class InstanceView(generics.RetrieveUpdateDestroyAPIView):
31
31
authentication_classes = [authentication .BasicAuthentication ]
32
32
permission_classes = [permissions .DjangoModelPermissions ]
33
33
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
+
34
44
root_view = RootView .as_view ()
35
45
instance_view = InstanceView .as_view ()
46
+ get_queryset_list_view = GetQuerySetListView .as_view ()
36
47
37
48
38
49
def basic_auth_header (username , password ):
@@ -67,6 +78,12 @@ def test_has_create_permissions(self):
67
78
response = root_view (request , pk = 1 )
68
79
self .assertEqual (response .status_code , status .HTTP_201_CREATED )
69
80
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
+
70
87
def test_has_put_permissions (self ):
71
88
request = factory .put ('/1' , {'text' : 'foobar' }, format = 'json' ,
72
89
HTTP_AUTHORIZATION = self .permitted_credentials )
0 commit comments