Skip to content

Commit

Permalink
Merge pull request #18 from SVilgelm/rbac-utils
Browse files Browse the repository at this point in the history
Fix using rbac utils
  • Loading branch information
aveeshek authored Mar 18, 2019
2 parents 9120a7a + e569cb5 commit a00473f
Show file tree
Hide file tree
Showing 44 changed files with 323 additions and 324 deletions.
1 change: 0 additions & 1 deletion tungsten_tempest_plugin/tests/api/contrail/rbac_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def setup_clients(cls):
cls.admin_client = cls.os_admin.networks_client
dscv = CONF.identity.disable_ssl_certificate_validation
ca_certs = CONF.identity.ca_certificates_file
cls.setup_rbac_utils()

cls.access_control_client = AccessControlClient(
cls.auth_provider,
Expand Down
20 changes: 10 additions & 10 deletions tungsten_tempest_plugin/tests/api/contrail/test_access_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ def _create_access_control_lists(self, sec_group_name):
@decorators.idempotent_id('2bfde8fd-36fe-4e69-ba59-6f2db8941e7d')
def test_list_api_access_lists(self):
"""test method for list api access list"""
with self.rbac_utils.override_role(self):
with self.override_role():
self.access_control_client.list_api_access_lists()

@rbac_rule_validation.action(service="Contrail",
rules=["create_api_access_lists"])
@decorators.idempotent_id('b2b5f50c-07d8-4d79-b9a4-78187ad97353')
def test_create_api_access_lists(self):
"""test method for create api access list"""
with self.rbac_utils.override_role(self):
with self.override_role():
self._create_api_access_lists()

@rbac_rule_validation.action(service="Contrail",
Expand All @@ -95,7 +95,7 @@ def test_create_api_access_lists(self):
def test_show_api_access_list(self):
"""test method for show api access list"""
new_api_list = self._create_api_access_lists()
with self.rbac_utils.override_role(self):
with self.override_role():
self.access_control_client.show_api_access_list(
new_api_list['uuid'])

Expand All @@ -106,7 +106,7 @@ def test_update_api_access_list(self):
"""test method for update api access list"""
new_api_list = self._create_api_access_lists()
update_name = data_utils.rand_name('test')
with self.rbac_utils.override_role(self):
with self.override_role():
self.access_control_client.update_api_access_list(
new_api_list['uuid'],
display_name=update_name)
Expand All @@ -117,7 +117,7 @@ def test_update_api_access_list(self):
def test_delete_api_access_list(self):
"""test method for delete api access list"""
new_api_list = self._create_api_access_lists()
with self.rbac_utils.override_role(self):
with self.override_role():
self.access_control_client.delete_api_access_list(
new_api_list['uuid'])

Expand All @@ -126,7 +126,7 @@ def test_delete_api_access_list(self):
@decorators.idempotent_id('c56a1338-a9d1-4286-8aeb-3a0d60d93037')
def test_list_access_control_lists(self):
"""test method for list access control list"""
with self.rbac_utils.override_role(self):
with self.override_role():
self.access_control_client.list_access_control_lists()

@rbac_rule_validation.action(service="Contrail",
Expand All @@ -136,7 +136,7 @@ def test_create_access_control(self):
"""test method for create access control list"""
# Create Security Group
sec_group = self._create_security_groups()
with self.rbac_utils.override_role(self):
with self.override_role():
self._create_access_control_lists(sec_group['name'])

@rbac_rule_validation.action(service="Contrail",
Expand All @@ -148,7 +148,7 @@ def test_show_access_control_list(self):
sec_group = self._create_security_groups()
new_ctrl_list = self._create_access_control_lists(
sec_group['name'])
with self.rbac_utils.override_role(self):
with self.override_role():
self.access_control_client.show_access_control_list(
new_ctrl_list['uuid'])

Expand All @@ -161,7 +161,7 @@ def test_update_access_control_list(self):
new_ctrl_list = self._create_access_control_lists(
sec_group['name'])
update_name = data_utils.rand_name('test')
with self.rbac_utils.override_role(self):
with self.override_role():
self.access_control_client.update_access_control_list(
new_ctrl_list['uuid'],
display_name=update_name)
Expand All @@ -175,6 +175,6 @@ def test_delete_access_control_list(self):
sec_group = self._create_security_groups()
new_ctrl_list = self._create_access_control_lists(
sec_group['name'])
with self.rbac_utils.override_role(self):
with self.override_role():
self.access_control_client.delete_access_control_list(
new_ctrl_list['uuid'])
10 changes: 5 additions & 5 deletions tungsten_tempest_plugin/tests/api/contrail/test_alarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ def _update_alarm(self, alarm_uuid):
@decorators.idempotent_id('dc7d19dd-dd5e-4ec8-bf0c-c6d9d83a60a8')
def test_list_alarms(self):
"""test method for list alarms"""
with self.rbac_utils.override_role(self):
with self.override_role():
self.alarm_client.list_alarms()

@rbac_rule_validation.action(service="Contrail",
rules=["create_alarms"])
@decorators.idempotent_id('7fe55d0c-e54a-4bb7-95a6-9c53f9e9c4bf')
def test_create_alarms(self):
"""test method for create alarms"""
with self.rbac_utils.override_role(self):
with self.override_role():
self._create_alarm()

@rbac_rule_validation.action(service="Contrail",
Expand All @@ -91,7 +91,7 @@ def test_create_alarms(self):
def test_show_alarm(self):
"""test method for show alarms"""
alarm_uuid = self._create_alarm()
with self.rbac_utils.override_role(self):
with self.override_role():
self.alarm_client.show_alarm(alarm_uuid)

@rbac_rule_validation.action(service="Contrail",
Expand All @@ -100,7 +100,7 @@ def test_show_alarm(self):
def test_update_alarm(self):
"""test method for update alarms"""
alarm_uuid = self._create_alarm()
with self.rbac_utils.override_role(self):
with self.override_role():
self._update_alarm(alarm_uuid)

@rbac_rule_validation.action(service="Contrail",
Expand All @@ -110,5 +110,5 @@ def test_delete_alarm(self):
"""test method for delete alarms"""
# Create global system config
alarm_uuid = self._create_alarm()
with self.rbac_utils.override_role(self):
with self.override_role():
self.alarm_client.delete_alarm(alarm_uuid)
20 changes: 10 additions & 10 deletions tungsten_tempest_plugin/tests/api/contrail/test_alias_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _create_alias_ips(self, alias_ip_pool, address):
@decorators.idempotent_id('899d6824-0755-41ef-adef-03eb1858bcb0')
def test_list_alias_ips(self):
"""test method for list alias IP"""
with self.rbac_utils.override_role(self):
with self.override_role():
self.alias_ip_client.list_alias_ips()

@rbac_rule_validation.action(service="Contrail",
Expand All @@ -125,7 +125,7 @@ def test_list_alias_ips(self):
def test_create_alias_ips(self):
"""test method for create alias IP"""
new_alias_ip_pool = self._create_alias_ip_pools()
with self.rbac_utils.override_role(self):
with self.override_role():
self._create_alias_ips(new_alias_ip_pool, '2.2.3.1')

@rbac_rule_validation.action(service="Contrail",
Expand All @@ -135,7 +135,7 @@ def test_show_alias_ip(self):
"""test method for show alias IP"""
new_alias_ip_pool = self._create_alias_ip_pools()
new_alias_ip = self._create_alias_ips(new_alias_ip_pool, '2.2.3.2')
with self.rbac_utils.override_role(self):
with self.override_role():
self.alias_ip_client.show_alias_ip(
new_alias_ip['uuid'])

Expand All @@ -147,7 +147,7 @@ def test_update_alias_ip(self):
new_alias_ip_pool = self._create_alias_ip_pools()
new_alias_ip = self._create_alias_ips(new_alias_ip_pool, '2.2.3.3')
update_name = data_utils.rand_name('test')
with self.rbac_utils.override_role(self):
with self.override_role():
self.alias_ip_client.update_alias_ip(
new_alias_ip['uuid'],
display_name=update_name)
Expand All @@ -159,7 +159,7 @@ def test_delete_alias_ip(self):
"""test method for delete alias IP"""
new_alias_ip_pool = self._create_alias_ip_pools()
new_alias_ip = self._create_alias_ips(new_alias_ip_pool, '2.2.3.4')
with self.rbac_utils.override_role(self):
with self.override_role():
self.alias_ip_client.delete_alias_ip(
new_alias_ip['uuid'])

Expand All @@ -168,15 +168,15 @@ def test_delete_alias_ip(self):
@decorators.idempotent_id('ffe85f35-589a-4b90-a1d3-6aed92a85954')
def test_list_alias_ip_pools(self):
"""est method for list alias IP pools"""
with self.rbac_utils.override_role(self):
with self.override_role():
self.alias_ip_client.list_alias_ip_pools()

@rbac_rule_validation.action(service="Contrail",
rules=["create_alias_ip_pools"])
@decorators.idempotent_id('83abd2c0-d46a-4337-87d0-31cdb86e4226')
def test_create_alias_ip_pools(self):
"""test method for create alias IP pool"""
with self.rbac_utils.override_role(self):
with self.override_role():
self._create_alias_ip_pools()

@rbac_rule_validation.action(service="Contrail",
Expand All @@ -185,7 +185,7 @@ def test_create_alias_ip_pools(self):
def test_show_alias_ip_pool(self):
"""test method for show alias IP pool"""
new_alias_ip_pool = self._create_alias_ip_pools()
with self.rbac_utils.override_role(self):
with self.override_role():
self.alias_ip_client.show_alias_ip_pool(
new_alias_ip_pool['uuid'])

Expand All @@ -196,7 +196,7 @@ def test_update_alias_ip_pool(self):
"""test method for update alias IP pool"""
new_alias_ip_pool = self._create_alias_ip_pools()
update_name = data_utils.rand_name('test')
with self.rbac_utils.override_role(self):
with self.override_role():
self.alias_ip_client.update_alias_ip_pool(
new_alias_ip_pool['uuid'],
display_name=update_name)
Expand All @@ -207,6 +207,6 @@ def test_update_alias_ip_pool(self):
def test_delete_alias_ip_pool(self):
"""test method for delete alias IP pool"""
new_alias_ip_pool = self._create_alias_ip_pools()
with self.rbac_utils.override_role(self):
with self.override_role():
self.alias_ip_client.delete_alias_ip_pool(
new_alias_ip_pool['uuid'])
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _create_analytics_node(self):
@decorators.idempotent_id('d3002e37-4b42-446d-b144-1b53f0dadfd3')
def test_list_analytics_nodes(self):
"""test method for list analytics nodes"""
with self.rbac_utils.override_role(self):
with self.override_role():
self.analytics_node_client.list_analytics_nodes()

@rbac_rule_validation.action(service="Contrail",
Expand All @@ -59,15 +59,15 @@ def test_list_analytics_nodes(self):
def test_show_analytics_node(self):
"""test method for show analytics nodes"""
new_node = self._create_analytics_node()
with self.rbac_utils.override_role(self):
with self.override_role():
self.analytics_node_client.show_analytics_node(new_node['uuid'])

@rbac_rule_validation.action(service="Contrail",
rules=["create_analytics_nodes"])
@decorators.idempotent_id('c57482c9-fcb4-4f41-95b0-7f0ffeee3dc3')
def test_create_analytics_nodes(self):
"""test method for create analytics nodes"""
with self.rbac_utils.override_role(self):
with self.override_role():
self._create_analytics_node()

@rbac_rule_validation.action(service="Contrail",
Expand All @@ -77,7 +77,7 @@ def test_update_analytics_node(self):
"""test method for update analytics nodes"""
new_node = self._create_analytics_node()
update_name = data_utils.rand_name('updated_node')
with self.rbac_utils.override_role(self):
with self.override_role():
self.analytics_node_client.update_analytics_node(
new_node['uuid'], display_name=update_name)

Expand All @@ -87,5 +87,5 @@ def test_update_analytics_node(self):
def test_delete_analytics_node(self):
"""test method for delete analytics nodes"""
new_node = self._create_analytics_node()
with self.rbac_utils.override_role(self):
with self.override_role():
self.analytics_node_client.delete_analytics_node(new_node['uuid'])
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ def _create_customer_attachments(self):
@decorators.idempotent_id('961dbf54-ae4f-42e8-9d27-69fa7df39013')
def test_list_provider_attachments(self):
"""test method for list provider attachment objects"""
with self.rbac_utils.override_role(self):
with self.override_role():
self.attachments_client.list_provider_attachments()

@rbac_rule_validation.action(service="Contrail",
rules=["create_provider_attachments"])
@decorators.idempotent_id('73ad032e-3e81-4dcc-be55-1987484207cd')
def test_create_providerattach(self):
"""test method for create provider attachment objects"""
with self.rbac_utils.override_role(self):
with self.override_role():
self._create_provider_attachments()

@rbac_rule_validation.action(service="Contrail",
Expand All @@ -78,7 +78,7 @@ def test_create_providerattach(self):
def test_show_provider_attachment(self):
"""test method for delete provider attachment objects"""
new_provider = self._create_provider_attachments()
with self.rbac_utils.override_role(self):
with self.override_role():
self.attachments_client.show_provider_attachment(
new_provider['uuid'])

Expand All @@ -89,7 +89,7 @@ def test_update_provider_attachment(self):
"""test method for update provider attachment objects"""
new_provider = self._create_provider_attachments()
update_name = data_utils.rand_name('test')
with self.rbac_utils.override_role(self):
with self.override_role():
self.attachments_client.update_provider_attachment(
new_provider['uuid'],
display_name=update_name)
Expand All @@ -100,7 +100,7 @@ def test_update_provider_attachment(self):
def test_delete_provider_attachment(self):
"""test method for delete provider attachment objects"""
new_provider = self._create_provider_attachments()
with self.rbac_utils.override_role(self):
with self.override_role():
self.attachments_client.delete_provider_attachment(
new_provider['uuid'])

Expand All @@ -109,15 +109,15 @@ def test_delete_provider_attachment(self):
@decorators.idempotent_id('3eca8fd8-ec3c-4a0e-8f62-b15d28796b7f')
def test_list_customer_attachments(self):
"""test method for list customer attachment objects"""
with self.rbac_utils.override_role(self):
with self.override_role():
self.attachments_client.list_customer_attachments()

@rbac_rule_validation.action(service="Contrail",
rules=["create_customer_attachments"])
@decorators.idempotent_id('53f93053-554c-4202-b763-0230d9a0553a')
def test_create_customerattachments(self):
"""test method for create customer attachment objects"""
with self.rbac_utils.override_role(self):
with self.override_role():
self._create_customer_attachments()

@rbac_rule_validation.action(service="Contrail",
Expand All @@ -126,7 +126,7 @@ def test_create_customerattachments(self):
def test_show_customer_attachment(self):
"""test method for show customer attachment objects"""
new_customer = self._create_customer_attachments()
with self.rbac_utils.override_role(self):
with self.override_role():
self.attachments_client.show_customer_attachment(
new_customer['uuid'])

Expand All @@ -137,7 +137,7 @@ def test_update_customer_attachment(self):
"""test method for update customer attachment objects"""
new_customer = self._create_customer_attachments()
update_name = data_utils.rand_name('test')
with self.rbac_utils.override_role(self):
with self.override_role():
self.attachments_client.update_customer_attachment(
new_customer['uuid'],
display_name=update_name)
Expand All @@ -148,6 +148,6 @@ def test_update_customer_attachment(self):
def test_delete_customer_attachment(self):
"""test method for delete customer attachment objects"""
new_customer = self._create_customer_attachments()
with self.rbac_utils.override_role(self):
with self.override_role():
self.attachments_client.delete_customer_attachment(
new_customer['uuid'])
Loading

0 comments on commit a00473f

Please sign in to comment.