From c6a6d7ac15b351e2d81685abefd44542367b6e6f Mon Sep 17 00:00:00 2001 From: Mark Aaron Shirley Date: Wed, 19 Dec 2012 07:33:49 -0800 Subject: [PATCH] remove all but the 'read' nested serializer tests --- rest_framework/tests/nested_relations.py | 40 ------------------------ 1 file changed, 40 deletions(-) diff --git a/rest_framework/tests/nested_relations.py b/rest_framework/tests/nested_relations.py index 0d4d6ce89..b9022cac2 100644 --- a/rest_framework/tests/nested_relations.py +++ b/rest_framework/tests/nested_relations.py @@ -44,11 +44,6 @@ class ReverseForeignKeyTests(TestCase): self.new_target_data = {'id': 2, 'name': u'target-2', 'sources': []} self.data = [self.target_data, self.new_target_data] - def save_serialized_target(self, instance, data): - serializer = ForeignKeyTargetSerializer(instance, data=data) - self.assertTrue(serializer.is_valid()) - serializer.save() - def check_serialized_targets(self, data): queryset = ForeignKeyTarget.objects.all() serializer = ForeignKeyTargetSerializer(queryset) @@ -56,38 +51,3 @@ class ReverseForeignKeyTests(TestCase): def test_reverse_foreign_key_retrieve(self): self.check_serialized_targets(self.data) - - def test_reverse_foreign_key_create(self): - data = deepcopy(self.new_target_data) - data['sources'].append({'name': u'source-4', 'target': 2}) - instance = ForeignKeyTarget.objects.get(pk=2) - self.save_serialized_target(instance, data) - - # Ensure target 2 has new source and everything else is as expected - expected = deepcopy(self.data) - expected[1]['sources'].append({'id': 4, 'name': 'source-4', 'target': 2}) - self.check_serialized_targets(expected) - - def test_reverse_foreign_key_update(self): - data = deepcopy(self.target_data) - data['sources'][0]['name'] = 'source-1-changed' - data['sources'][2]['name'] = 'source-3-changed' - instance = ForeignKeyTarget.objects.get(pk=1) - self.save_serialized_target(instance, data) - - # Ensure target 1 is updated, and everything else is as expected - expected = deepcopy(self.data) - expected[0]['sources'][0]['name'] = 'source-1-changed' - expected[0]['sources'][2]['name'] = 'source-3-changed' - self.check_serialized_targets(expected) - - def test_reverse_foreign_key_delete(self): - data = deepcopy(self.target_data) - del data['sources'][2] - instance = ForeignKeyTarget.objects.get(pk=1) - self.save_serialized_target(instance, data) - - # Ensure target 1 has 2 sources and everything else is as expected - expected = deepcopy(self.data) - del expected[0]['sources'][2] - self.check_serialized_targets(expected)