Merge "Migrate to override_role for network metering tests"
diff --git a/patrole_tempest_plugin/tests/api/network/test_metering_label_rules_rbac.py b/patrole_tempest_plugin/tests/api/network/test_metering_label_rules_rbac.py
index 5ffc966..7a9d814 100644
--- a/patrole_tempest_plugin/tests/api/network/test_metering_label_rules_rbac.py
+++ b/patrole_tempest_plugin/tests/api/network/test_metering_label_rules_rbac.py
@@ -70,8 +70,8 @@
RBAC test for the neutron create_metering_label_rule policy
"""
- self.rbac_utils.switch_role(self, toggle_rbac_role=True)
- self._create_metering_label_rule(self.label)
+ with self.rbac_utils.override_role(self):
+ self._create_metering_label_rule(self.label)
@rbac_rule_validation.action(service="neutron",
rule="get_metering_label_rule",
@@ -83,9 +83,9 @@
RBAC test for the neutron get_metering_label_rule policy
"""
label_rule = self._create_metering_label_rule(self.label)
- self.rbac_utils.switch_role(self, toggle_rbac_role=True)
- self.metering_label_rules_client.show_metering_label_rule(
- label_rule['id'])
+ with self.rbac_utils.override_role(self):
+ self.metering_label_rules_client.show_metering_label_rule(
+ label_rule['id'])
@rbac_rule_validation.action(service="neutron",
rule="delete_metering_label_rule",
@@ -97,6 +97,6 @@
RBAC test for the neutron delete_metering_label_rule policy
"""
label_rule = self._create_metering_label_rule(self.label)
- self.rbac_utils.switch_role(self, toggle_rbac_role=True)
- self.metering_label_rules_client.delete_metering_label_rule(
- label_rule['id'])
+ with self.rbac_utils.override_role(self):
+ self.metering_label_rules_client.delete_metering_label_rule(
+ label_rule['id'])