def test_clone_cow(self):
        """Clone with COW."""
        pool = mock.Mock()
        volume = mock.Mock()
        hypervisor = mock.Mock()
        hypervisor.storageVolLookupByPath.return_value = volume
        pool.XMLDesc.return_value = """<pool><target><path>/pool/path</path></target></pool>"""
        volume.XMLDesc.return_value = """<volume><target><path>/path/volume.qcow2</path></target>""" +\
                                      """<capacity>10</capacity></volume>"""
        expected = """<volume type="file"><name>foo</name><uuid>foo</uuid><target>""" +\
                   """<path>/pool/path/foo.qcow2</path><permissions><mode>0644</mode></permissions>""" +\
                   """<format type="qcow2" /></target><capacity>10</capacity>""" +\
                   """<backingStore><path>/path/volume.qcow2</path><format type="qcow2" />""" +\
                   """</backingStore></volume>"""
        qemu.disk_clone(hypervisor, 'foo', pool, {'image': '/foo/bar/baz.qcow2', 'clone': {'copy_on_write': True}})
        results = pool.createXML.call_args_list[0][0][0]
        results = results.replace('\n', '').replace('\t', '').replace('  ', '')
        self.assertEqual(results, expected, compare(results, expected))
dataset/ETHPy150Open F-Secure/see/see/context/resources/test/qemu_test.py/DiskCloneTest.test_clone_cow/original