

def test_floating_ip_allocate(self):
    pool_name = 'fip_pool'
    fip = [fip for fip in self.api_floating_ips.list() if (not fip.instance_id)][0]
    novaclient = self.stub_novaclient()
    novaclient.floating_ips = self.mox.CreateMockAnything()
    novaclient.floating_ips.create(pool=pool_name).AndReturn(fip)
    self.mox.ReplayAll()
    ret = api.network.tenant_floating_ip_allocate(self.request, pool_name)
    for attr in ['id', 'ip', 'pool', 'fixed_ip', 'instance_id']:
        self.assertEqual(getattr(fip, attr), getattr(ret, attr))
    self.assertIsNone(ret.port_id)
    self.assertIsNone(ret.instance_type)

dataset/ETHPy150Open CiscoSystems/avos/openstack_dashboard/test/api_tests/network_tests.py NetworkApiNovaFloatingIpTests.test_floating_ip_allocate/original