

def test_create_network(self):
    'Create with network.'
    xml = '<domain></domain>'
    expected = (('<domain><name>foo</name><uuid>foo</uuid><devices><disk device="disk" type="file">' + '<source file="/diskpath.qcow2" /></disk><interface type="network">') + '<source network="foo" /></interface></devices></domain>')
    hypervisor = mock.Mock()
    hypervisor.listNetworks.return_value = []
    with mock.patch('see.context.resources.qemu.open', mock.mock_open(read_data=xml), create=True):
        qemu.domain_create(hypervisor, 'foo', {
            'configuration': '/foo',
        }, '/diskpath.qcow2', network_name='foo')
    results = hypervisor.defineXML.call_args_list[0][0][0]
    self.assertEqual(hypervisor, expected, compare(results, expected))

dataset/ETHPy150Open F-Secure/see/see/context/resources/test/qemu_test.py DomainCreateTest.test_create_network/VarMisuse@114/231 `results`->`hypervisor`