def test_get_updated_guest_xml(self, mock_volume, mock_serial, mock_graphics, mock_tostring): data = objects.LibvirtLiveMigrateData() mock_guest = mock.Mock(spec=libvirt_guest.Guest) get_volume_config = mock.MagicMock() mock_guest.get_xml_desc.return_value = '<domain></domain>' migration.get_updated_guest_xml(mock_guest, data, get_volume_config) mock_graphics.assert_called_once_with(mock.ANY, data) mock_serial.assert_called_once_with(mock.ANY, data) mock_volume.assert_called_once_with(mock.ANY, data, get_volume_config) self.assertEqual(1, mock_tostring.called)