def test_create_rbac_policy_with_mandatory_params(self): """Create rbac: rbac_object --type network --action access_as_shared""" resource = 'rbac_policy' cmd = rbac.CreateRBACPolicy(test_cli20.MyApp(sys.stdout), None) name = 'rbac_object' myid = 'myid' args = [name, '--type', 'network', '--action', 'access_as_shared'] position_names = [ 'object_id', 'object_type', 'target_tenant', 'action' ] position_values = [name, 'network', None, 'access_as_shared'] self._test_create_resource(resource, cmd, name, myid, args, position_names, position_values)
def test_create_rbac_policy_with_unicode(self): """Create rbac policy u'\u7f51\u7edc'.""" resource = 'rbac_policy' cmd = rbac.CreateRBACPolicy(test_cli20.MyApp(sys.stdout), None) name = u'\u7f51\u7edc' myid = 'myid' args = [ name, '--type', 'network', '--target-tenant', 'tenant_id', '--action', 'access_as_external' ] position_names = [ 'object_id', 'object_type', 'target_tenant', 'action' ] position_values = [name, 'network', 'tenant_id', 'access_as_external'] self._test_create_resource(resource, cmd, name, myid, args, position_names, position_values)
def test_create_rbac_policy_with_all_params(self): # Create rbac: rbac_object --type <object_type_name> # --target-tenant tenant_id --action access_as_external resource = 'rbac_policy' cmd = rbac.CreateRBACPolicy(test_cli20.MyApp(sys.stdout), None) name = 'rbac_object' myid = 'myid' args = [ name, '--type', self.object_type_name, '--target-tenant', 'tenant_id', '--action', 'access_as_external' ] position_names = [ 'object_id', 'object_type', 'target_tenant', 'action' ] position_values = [ name, self.object_type_val, 'tenant_id', 'access_as_external' ] self._test_create_resource(resource, cmd, name, myid, args, position_names, position_values)