'Test related elements serialization with backport of the last child.
Test that using the manifest we properly backport a child object even
when all its parents have not changed their version.'

@mock.patch('cinder.objects.base.LOG.debug')
def test_serialize_entity_full_backport_last_children(self, log_debug_mock):

    serializer = objects.base.CinderObjectSerializer('1.5')
    primitive = serializer.serialize_entity(self.context, self.parent_list)
    self.assertEqual('1.1', primitive['versioned_object.version'])
    parent = primitive['versioned_object.data']['objects'][0]
    self.assertEqual('1.1', parent['versioned_object.version'])
    child = parent['versioned_object.data']['child']
    self.assertEqual('1.1', child['versioned_object.version'])
    data = child['versioned_object.data']
    self.assertNotIn('integer', data)
    self.assertEqual('text', data['text'])
    log_debug_mock.assert_called_once_with(self.BACKPORT_MSG, {'obj_name': 'ChildObject', 'src_vers': '1.2', 'dst_vers': '1.1'})
