

def test_target_floating_ip_port_by_instance(self):
    ports = self.api_ports.list()
    candidates = [p for p in ports if (p['device_id'] == '1')]
    search_opts = {
        'device_id': '1',
    }
    self.qclient.list_ports(**search_opts).AndReturn({
        'ports': candidates,
    })
    self.mox.ReplayAll()
    ret = api.network.floating_ip_target_list_by_instance(self.request, '1')
    self.assertEqual(self._get_target_id(candidates[0]), ret[0])
    self.assertEqual(len(candidates), len(ret))

dataset/ETHPy150Open CiscoSystems/avos/openstack_dashboard/test/api_tests/network_tests.py NetworkApiNeutronFloatingIpTests.test_target_floating_ip_port_by_instance/original