              self.writer_credentials = basic_auth_header('writer', 'password')
              self.full_access_credentials = basic_auth_header('full_access', 'password')
  
  
          def test_has_delete_permissions(self):
              request = factory.delete('/1', HTTP_AUTHORIZATION=self.full_access_credentials)
              response = object_permissions_view(request, pk='1')
              self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
  
          def test_no_delete_permissions(self):
              request = factory.delete('/1', HTTP_AUTHORIZATION=self.writer_credentials)
 
</s> remove             self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
 </s> add             self.assertEqual(response.status_code, status.HTTP_200_OK) </s> remove             self.no_permission_credentials = basic_auth_header('no_permission', 'password')
            self.reader_credentials = basic_auth_header('reader', 'password')
            self.writer_credentials = basic_auth_header('writer', 'password')
            self.full_access_credentials = basic_auth_header('full_access', 'password')
 </s> add         # Update
        def test_can_update_permissions(self):
            request = factory.patch('/1', {'text': 'foobar'}, format='json',
                HTTP_AUTHORIZATION=self.credentials['writeonly'])
            object_permissions_view.cls.action = 'partial_update'
            response = object_permissions_view(request, pk='1')
            self.assertEqual(response.status_code, status.HTTP_200_OK)
            self.assertEqual(response.data.get('text'), 'foobar') </s> remove         def test_no_delete_permissions(self):
            request = factory.delete('/1', HTTP_AUTHORIZATION=self.writer_credentials)
 </s> add         def test_cannot_read_permissions(self):
            request = factory.get('/1', HTTP_AUTHORIZATION=self.credentials['writeonly'])
            object_permissions_view.cls.action = 'retrieve' </s> remove             # object level permissions
            assign_perm(delete, full_access, obj=model)
            (assign_perm(write, user, obj=model) for user in (writer, full_access))
            (assign_perm(read, user, obj=model) for user in (reader, writer, full_access))
 </s> add         def test_cannot_delete_permissions(self):
            request = factory.delete('/1', HTTP_AUTHORIZATION=self.credentials['readonly'])
            object_permissions_view.cls.action = 'destroy'
            response = object_permissions_view(request, pk='1')
            self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
        # Read
        def test_can_read_permissions(self):
            request = factory.get('/1', HTTP_AUTHORIZATION=self.credentials['readonly'])
            object_permissions_view.cls.action = 'retrieve'
              self.writer_credentials = basic_auth_header('writer', 'password')
              self.full_access_credentials = basic_auth_header('full_access', 'password')
  
  
        # Read
        def test_can_read_permissions(self):
            request = factory.get('/1', HTTP_AUTHORIZATION=self.credentials['readonly'])
            object_permissions_view.cls.action = 'retrieve'
        # Read
        def test_can_read_permissions(self):
            request = factory.get('/1', HTTP_AUTHORIZATION=self.credentials['readonly'])
            object_permissions_view.cls.action = 'retrieve'
              response = object_permissions_view(request, pk='1')
              self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
  
          def test_no_delete_permissions(self):
              request = factory.delete('/1', HTTP_AUTHORIZATION=self.writer_credentials)
keep keep keep keep replace replace keep keep keep keep keep
 first pass at object level permissions and tests 
rest_framework/tests/test_permissions.py