

@test.create_stubs({
    api.network: ('floating_ip_supported', 'tenant_floating_ip_list', 'security_group_list', 'floating_ip_pools_list'),
    api.nova: ('keypair_list', 'server_list'),
    quotas: ('tenant_quota_usages',),
    api.base: ('is_service_enabled',),
})
def test_create_button_attributes(self):
    keypairs = self.keypairs.list()
    floating_ips = self.floating_ips.list()
    floating_pools = self.pools.list()
    sec_groups = self.security_groups.list()
    quota_data = self.quota_usages.first()
    quota_data['security_groups']['available'] = 10
    api.network.floating_ip_supported(IsA(http.HttpRequest)).AndReturn(True)
    api.network.tenant_floating_ip_list(IsA(http.HttpRequest)).AndReturn(floating_ips)
    api.network.floating_ip_pools_list(IsA(http.HttpRequest)).AndReturn(floating_pools)
    api.network.security_group_list(IsA(http.HttpRequest)).AndReturn(sec_groups)
    api.nova.keypair_list(IsA(http.HttpRequest)).AndReturn(keypairs)
    api.nova.server_list(IsA(http.HttpRequest)).AndReturn([self.servers.list(), False])
    quotas.tenant_quota_usages(IsA(http.HttpRequest)).MultipleTimes().AndReturn(floating_ips)
    api.base.is_service_enabled(IsA(http.HttpRequest), 'network').MultipleTimes().AndReturn(True)
    api.base.is_service_enabled(IsA(http.HttpRequest), 'ec2').MultipleTimes().AndReturn(False)
    self.mox.ReplayAll()
    res = self.client.get((INDEX_URL + '?tab=access_security_tabs__security_groups_tab'))
    security_groups = res.context['security_groups_table'].data
    self.assertItemsEqual(security_groups, self.security_groups.list())
    create_action = self.getAndAssertTableAction(res, 'security_groups', 'create')
    self.assertEqual('Create Security Group', six.text_type(create_action.verbose_name))
    self.assertIsNone(create_action.policy_rules)
    self.assertEqual(set(['ajax-modal']), set(create_action.classes))
    url = 'horizon:project:access_and_security:security_groups:create'
    self.assertEqual(url, create_action.url)

dataset/ETHPy150Open openstack/horizon/openstack_dashboard/dashboards/project/access_and_security/tests.py SecurityGroupTabTests.test_create_button_attributes/VarMisuse@266/397 `quota_data`->`floating_ips`