

@test.create_stubs({
    api.network: ('floating_ip_target_list', 'tenant_floating_ip_list'),
})
def test_association(self):
    servers = [api.nova.Server(s, self.request) for s in self.servers.list()]
    server3 = api.nova.Server(self.servers.first(), self.request)
    server3.id = 101
    server3.addresses = deepcopy(server3.addresses)
    server3.addresses['private'][0]['addr'] = '10.0.0.5'
    servers.append(server3)
    targets = [api.nova.FloatingIpTarget(s) for s in servers]
    api.network.tenant_floating_ip_list(IsA(http.HttpRequest)).AndReturn(self.floating_ips.list())
    api.network.floating_ip_target_list(IsA(http.HttpRequest)).AndReturn(targets)
    self.mox.ReplayAll()
    res = self.client.get(reverse('horizon:project:access_and_security:floating_ips:associate'))
    self.assertTemplateUsed(res, views.WorkflowView.template_name)
    self.assertContains(res, '<option value="1">server_1 (1)</option>')
    self.assertContains(res, '<option value="101">server_1 (101)</option>')
    self.assertContains(res, '<option value="2">server_2 (2)</option>')

dataset/ETHPy150Open openstack/horizon/openstack_dashboard/dashboards/project/access_and_security/tests.py AccessAndSecurityTests.test_association/original