|
@@ -174,6 +174,7 @@ class APIViewTestCases:
|
|
|
|
|
|
|
|
class CreateObjectViewTestCase(APITestCase):
|
|
class CreateObjectViewTestCase(APITestCase):
|
|
|
create_data = []
|
|
create_data = []
|
|
|
|
|
+ validation_excluded_fields = []
|
|
|
|
|
|
|
|
def test_create_object_without_permission(self):
|
|
def test_create_object_without_permission(self):
|
|
|
"""
|
|
"""
|
|
@@ -205,6 +206,7 @@ class APIViewTestCases:
|
|
|
self.assertInstanceEqual(
|
|
self.assertInstanceEqual(
|
|
|
self._get_queryset().get(pk=response.data['id']),
|
|
self._get_queryset().get(pk=response.data['id']),
|
|
|
self.create_data[0],
|
|
self.create_data[0],
|
|
|
|
|
+ exclude=self.validation_excluded_fields,
|
|
|
api=True
|
|
api=True
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -229,11 +231,13 @@ class APIViewTestCases:
|
|
|
self.assertInstanceEqual(
|
|
self.assertInstanceEqual(
|
|
|
self._get_queryset().get(pk=obj['id']),
|
|
self._get_queryset().get(pk=obj['id']),
|
|
|
self.create_data[i],
|
|
self.create_data[i],
|
|
|
|
|
+ exclude=self.validation_excluded_fields,
|
|
|
api=True
|
|
api=True
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
class UpdateObjectViewTestCase(APITestCase):
|
|
class UpdateObjectViewTestCase(APITestCase):
|
|
|
update_data = {}
|
|
update_data = {}
|
|
|
|
|
+ validation_excluded_fields = []
|
|
|
|
|
|
|
|
def test_update_object_without_permission(self):
|
|
def test_update_object_without_permission(self):
|
|
|
"""
|
|
"""
|
|
@@ -266,7 +270,12 @@ class APIViewTestCases:
|
|
|
response = self.client.patch(url, update_data, format='json', **self.header)
|
|
response = self.client.patch(url, update_data, format='json', **self.header)
|
|
|
self.assertHttpStatus(response, status.HTTP_200_OK)
|
|
self.assertHttpStatus(response, status.HTTP_200_OK)
|
|
|
instance.refresh_from_db()
|
|
instance.refresh_from_db()
|
|
|
- self.assertInstanceEqual(instance, update_data, api=True)
|
|
|
|
|
|
|
+ self.assertInstanceEqual(
|
|
|
|
|
+ instance,
|
|
|
|
|
+ update_data,
|
|
|
|
|
+ exclude=self.validation_excluded_fields,
|
|
|
|
|
+ api=True
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
class DeleteObjectViewTestCase(APITestCase):
|
|
class DeleteObjectViewTestCase(APITestCase):
|
|
|
|
|
|