Added test for serializing child model without inherited fields.
This commit is contained in:
parent
895b15771e
commit
fb54aca540
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue