

def test_floating_ip_list(self):
    fips = self.api_q_floating_ips.list()
    filters = {
        'tenant_id': self.request.user.tenant_id,
    }
    self.qclient.list_floatingips(**exp).AndReturn({
        'floatingips': fips,
    })
    self.qclient.list_ports(**filters).AndReturn({
        'ports': self.api_ports.list(),
    })
    self.mox.ReplayAll()
    rets = api.network.tenant_floating_ip_list(self.request)
    assoc_port = self.api_ports.list()[1]
    self.assertEqual(len(fips), len(rets))
    for (ret, exp) in zip(rets, fips):
        for attr in ['id', 'ip', 'pool', 'fixed_ip', 'port_id']:
            self.assertEqual(exp[attr], getattr(ret, attr))
        if exp['port_id']:
            dev_id = (assoc_port['device_id'] if exp['port_id'] else None)
            self.assertEqual(dev_id, ret.instance_id)
            self.assertEqual('compute', ret.instance_type)
        else:
            self.assertIsNone(ret.instance_id)
            self.assertIsNone(ret.instance_type)

dataset/ETHPy150Open CiscoSystems/avos/openstack_dashboard/test/api_tests/network_tests.py NetworkApiNeutronFloatingIpTests.test_floating_ip_list/VarMisuse@44/60 `filters`->`exp`