Пример #1
0
 def get(self, path, data=None, follow=False, **extra):
     request = self.factory.get(
         path, data=data, SERVER_NAME='example.com', **extra)
     response = super(APIClient, self).get(
         path, data=data, follow=follow, SERVER_NAME='example.com', **extra)
     validator.validate_data(path, request, response)
     return response
Пример #2
0
    def patch(self,
              path,
              data=None,
              format=None,
              content_type=None,
              follow=False,
              **extra):
        validate_request = extra.pop('validate_request', True)
        validate_response = extra.pop('validate_response', True)

        request = self.factory.patch(path,
                                     data=data,
                                     format='json',
                                     content_type=content_type,
                                     SERVER_NAME='example.com',
                                     **extra)
        response = super(APIClient, self).patch(path,
                                                data=data,
                                                format='json',
                                                content_type=content_type,
                                                follow=follow,
                                                SERVER_NAME='example.com',
                                                **extra)

        validator.validate_data(path, request, response, validate_request,
                                validate_response)

        return response
Пример #3
0
 def patch(self, path, data=None, format=None, content_type=None,
           follow=False, **extra):
     request = self.factory.patch(
         path, data=data, format='json', content_type=content_type,
         SERVER_NAME='example.com', **extra)
     response = super(APIClient, self).patch(
         path, data=data, format='json', content_type=content_type,
         follow=follow, SERVER_NAME='example.com', **extra)
     validator.validate_data(path, request, response)
     return response
Пример #4
0
 def get(self, path, data=None, follow=False, **extra):
     request = self.factory.get(path,
                                data=data,
                                SERVER_NAME='example.com',
                                **extra)
     response = super(APIClient, self).get(path,
                                           data=data,
                                           follow=follow,
                                           SERVER_NAME='example.com',
                                           **extra)
     validator.validate_data(path, request, response)
     return response