def test_create_host_iface(self, mock_port_bind):
veth_driver = veth.VethDriver()
fake_endpoint_id = lib_utils.get_hash()
fake_neutron_port = uuidutils.generate_uuid()
fake_neutron_net_id = uuidutils.generate_uuid()
fake_neutron_v4_subnet_id = uuidutils.generate_uuid()
fake_neutron_v6_subnet_id = uuidutils.generate_uuid()
fake_subnets = self._get_fake_subnets(
fake_endpoint_id, fake_neutron_net_id,
fake_neutron_v4_subnet_id, fake_neutron_v6_subnet_id)
fake_network = mock.sentinel.binding_network
fake_exec_response = ('fake_stdout', '')
mock_port_bind.return_value = ('fake_host_ifname',
'fake_container_ifname', fake_exec_response)
response = veth_driver.create_host_iface(fake_endpoint_id,
fake_neutron_port, fake_subnets, fake_network)
mock_port_bind.assert_called_with(fake_endpoint_id,
fake_neutron_port, fake_subnets, fake_network)
self.assertEqual(response, fake_exec_response)
评论列表
文章目录