Merge "Define non_admin_status_resources in each test"
This commit is contained in:
commit
adc53158c8
@ -21,6 +21,9 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
|
||||
class CLITestV20QoSPolicyJSON(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['policy']
|
||||
|
||||
def setUp(self):
|
||||
super(CLITestV20QoSPolicyJSON, self).setUp()
|
||||
self.res = 'policy'
|
||||
|
@ -22,6 +22,9 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
|
||||
class CLITestV20QoSRuleJSON(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['bandwidth_limit_rule']
|
||||
|
||||
def setUp(self):
|
||||
super(CLITestV20QoSRuleJSON, self).setUp()
|
||||
self.res = 'bandwidth_limit_rule'
|
||||
|
@ -15,7 +15,6 @@
|
||||
#
|
||||
|
||||
import contextlib
|
||||
import copy
|
||||
import itertools
|
||||
import sys
|
||||
|
||||
@ -39,17 +38,6 @@ FORMAT = 'json'
|
||||
TOKEN = 'testtoken'
|
||||
ENDURL = 'localurl'
|
||||
|
||||
non_admin_status_resources = ['subnet', 'floatingip', 'security_group',
|
||||
'security_group_rule', 'qos_queue',
|
||||
'network_gateway', 'gateway_device',
|
||||
'credential', 'network_profile',
|
||||
'policy_profile', 'ikepolicy',
|
||||
'ipsecpolicy', 'metering_label',
|
||||
'metering_label_rule', 'net_partition',
|
||||
'fox_socket', 'subnetpool',
|
||||
'rbac_policy', 'address_scope',
|
||||
'policy', 'bandwidth_limit_rule']
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def capture_std_streams():
|
||||
@ -187,6 +175,8 @@ class CLITestV20Base(base.BaseTestCase):
|
||||
test_id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
|
||||
id_field = 'id'
|
||||
|
||||
non_admin_status_resources = []
|
||||
|
||||
def _find_resourceid(self, client, resource, name_or_id,
|
||||
cmd_resource=None, parent_id=None):
|
||||
return name_or_id
|
||||
@ -198,7 +188,6 @@ class CLITestV20Base(base.BaseTestCase):
|
||||
"""Prepare the test environment."""
|
||||
super(CLITestV20Base, self).setUp()
|
||||
client.Client.EXTED_PLURALS.update(constants.PLURALS)
|
||||
self.non_admin_status_resources = copy.copy(non_admin_status_resources)
|
||||
if plurals is not None:
|
||||
client.Client.EXTED_PLURALS.update(plurals)
|
||||
self.metadata = {'plurals': client.Client.EXTED_PLURALS,
|
||||
@ -221,6 +210,18 @@ class CLITestV20Base(base.BaseTestCase):
|
||||
self.client = client.Client(token=TOKEN, endpoint_url=self.endurl)
|
||||
|
||||
def register_non_admin_status_resource(self, resource_name):
|
||||
# TODO(amotoki):
|
||||
# It is recommended to define
|
||||
# "non_admin_status_resources in each test class rather than
|
||||
# using register_non_admin_status_resource method.
|
||||
|
||||
# If we change self.non_admin_status_resources like this,
|
||||
# we need to ensure this should be an instance variable
|
||||
# to avoid changing the class variable.
|
||||
if (id(self.non_admin_status_resources) ==
|
||||
id(self.__class__.non_admin_status_resources)):
|
||||
self.non_admin_status_resources = (self.__class__.
|
||||
non_admin_status_resources[:])
|
||||
self.non_admin_status_resources.append(resource_name)
|
||||
|
||||
def _test_create_resource(self, resource, cmd, name, myid, args,
|
||||
|
@ -24,6 +24,9 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
|
||||
class CLITestV20AddressScopeJSON(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['address_scope']
|
||||
|
||||
def setUp(self):
|
||||
super(CLITestV20AddressScopeJSON, self).setUp(plurals={'tags': 'tag'})
|
||||
|
||||
|
@ -22,6 +22,8 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
class CLITestV20Credential(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['credential']
|
||||
|
||||
def test_create_credential(self):
|
||||
"""Create credential: myid."""
|
||||
resource = 'credential'
|
||||
|
@ -21,6 +21,9 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
|
||||
class CLITestV20FloatingIpsJSON(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['floatingip']
|
||||
|
||||
def test_create_floatingip(self):
|
||||
"""Create floatingip: fip1."""
|
||||
resource = 'floatingip'
|
||||
|
@ -19,6 +19,9 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
|
||||
class CLITestV20MeteringJSON(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['metering_label', 'metering_label_rule']
|
||||
|
||||
def test_create_metering_label(self):
|
||||
"""Create a metering label."""
|
||||
resource = 'metering_label'
|
||||
|
@ -22,6 +22,8 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
class CLITestV20NetworkProfile(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['network_profile']
|
||||
|
||||
def test_create_networkprofile(self):
|
||||
"""Create networkprofile: myid."""
|
||||
resource = 'network_profile'
|
||||
|
@ -28,6 +28,8 @@ class CLITestV20NetworkGatewayJSON(test_cli20.CLITestV20Base):
|
||||
gw_resource = "network_gateway"
|
||||
dev_resource = "gateway_device"
|
||||
|
||||
non_admin_status_resources = ['network_gateway', 'gateway_device']
|
||||
|
||||
def setUp(self):
|
||||
super(CLITestV20NetworkGatewayJSON, self).setUp(
|
||||
plurals={'devices': 'device',
|
||||
|
@ -21,6 +21,9 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
|
||||
class CLITestV20QosQueueJSON(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['qos_queue']
|
||||
|
||||
def setUp(self):
|
||||
super(CLITestV20QosQueueJSON, self).setUp(
|
||||
plurals={'qos_queues': 'qos_queue'})
|
||||
|
@ -21,6 +21,7 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
class CLITestV20NetPartitionJSON(test_cli20.CLITestV20Base):
|
||||
resource = 'net_partition'
|
||||
non_admin_status_resources = ['net_partition']
|
||||
|
||||
def test_create_netpartition(self):
|
||||
cmd = netpartition.CreateNetPartition(test_cli20.MyApp(sys.stdout),
|
||||
|
@ -22,6 +22,8 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
class CLITestV20PolicyProfile(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['policy_profile']
|
||||
|
||||
def test_list_policyprofile_detail(self):
|
||||
"""List policyprofile: -D."""
|
||||
resources = 'policy_profiles'
|
||||
|
@ -20,6 +20,9 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
|
||||
class CLITestV20RBACJSON(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['rbac_policy']
|
||||
|
||||
def test_create_rbac_policy_with_mandatory_params(self):
|
||||
"""Create rbac: rbac_object --type network --action access_as_shared"""
|
||||
resource = 'rbac_policy'
|
||||
|
@ -27,6 +27,9 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
|
||||
class CLITestV20SecurityGroupsJSON(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['security_group', 'security_group_rule']
|
||||
|
||||
def test_create_security_group(self):
|
||||
"""Create security group: webservers."""
|
||||
resource = 'security_group'
|
||||
|
@ -25,6 +25,9 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
|
||||
class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['subnet']
|
||||
|
||||
def setUp(self):
|
||||
super(CLITestV20SubnetJSON, self).setUp(plurals={'tags': 'tag'})
|
||||
|
||||
|
@ -24,6 +24,9 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
|
||||
class CLITestV20SubnetPoolJSON(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['subnetpool']
|
||||
|
||||
def setUp(self):
|
||||
super(CLITestV20SubnetPoolJSON, self).setUp(plurals={'tags': 'tag'})
|
||||
|
||||
|
@ -26,6 +26,9 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
|
||||
class CLITestV20ExtensionJSON(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['fox_socket']
|
||||
|
||||
def setUp(self):
|
||||
# need to mock before super because extensions loaded on instantiation
|
||||
self._mock_extension_loading()
|
||||
|
@ -22,6 +22,8 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
class CLITestV20VpnIkePolicyJSON(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['ikepolicy']
|
||||
|
||||
def test_create_ikepolicy_all_params(self):
|
||||
"""vpn-ikepolicy-create all params."""
|
||||
resource = 'ikepolicy'
|
||||
|
@ -22,6 +22,8 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
class CLITestV20VpnIpsecPolicyJSON(test_cli20.CLITestV20Base):
|
||||
|
||||
non_admin_status_resources = ['ipsecpolicy']
|
||||
|
||||
def test_create_ipsecpolicy_all_params(self):
|
||||
"""vpn-ipsecpolicy-create all params with dashes."""
|
||||
resource = 'ipsecpolicy'
|
||||
|
Loading…
x
Reference in New Issue
Block a user