Added test for serializing child model without inherited fields.

This commit is contained in:
Nadège Michel 2019-06-27 11:32:56 +02:00 committed by Mariusz Felisiak
parent 895b15771e
commit fb54aca540
1 changed files with 2 additions and 1 deletions

View File

@ -341,12 +341,13 @@ class SerializersTestBase:
self.assertEqual(base_data, proxy_data.replace('proxy', ''))
self.assertEqual(base_data, proxy_proxy_data.replace('proxy', ''))
def test_serialize_inherited_m2m(self):
def test_serialize_inherited_fields(self):
child_1 = Child.objects.create(parent_data='a', child_data='b')
child_2 = Child.objects.create(parent_data='c', child_data='d')
child_1.parent_m2m.add(child_2)
child_data = serializers.serialize(self.serializer_name, [child_1, child_2])
self.assertEqual(self._get_field_values(child_data, 'parent_m2m'), [])
self.assertEqual(self._get_field_values(child_data, 'parent_data'), [])
class SerializerAPITests(SimpleTestCase):