How to use identity_utils method in tempest

Best Python code snippet using tempest_python

forms.py

Source:forms.py Github

copy

Full Screen

1# Copyright 2013 Hewlett-Packard Development Company, L.P.2#3# Licensed under the Apache License, Version 2.0 (the "License"); you may4# not use this file except in compliance with the License. You may obtain5# a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the12# License for the specific language governing permissions and limitations13# under the License.14import logging15from django.utils.translation import ugettext_lazy as _16from horizon import exceptions17from horizon import forms18from horizon import messages19from openstack_dashboard import api20from openstack_dashboard.utils import identity as identity_utils21LOG = logging.getLogger(__name__)22class CreateGroupForm(forms.SelfHandlingForm):23 name = forms.CharField(label=_("Name"),24 max_length=64)25 description = forms.CharField(widget=forms.widgets.Textarea(26 attrs={'rows': 4}),27 label=_("Description"),28 required=False)29 def handle(self, request, data):30 try:31 LOG.info('Creating group with name "%s"', data['name'])32 api.keystone.group_create(33 request,34 domain_id=identity_utils.get_domain_id_for_operation(35 self.request),36 name=data['name'],37 description=data['description'])38 messages.success(request,39 _('Group "%s" was successfully created.')40 % data['name'])41 except Exception:42 exceptions.handle(request, _('Unable to create group.'))43 return False44 return True45class UpdateGroupForm(forms.SelfHandlingForm):46 group_id = forms.CharField(widget=forms.HiddenInput())47 name = forms.CharField(label=_("Name"),48 max_length=64)49 description = forms.CharField(widget=forms.widgets.Textarea(50 attrs={'rows': 4}),51 label=_("Description"),52 required=False)53 def handle(self, request, data):54 group_id = data.pop('group_id')55 try:56 api.keystone.group_update(request,57 group_id=group_id,58 name=data['name'],59 description=data['description'])60 messages.success(request,61 _('Group has been updated successfully.'))62 except Exception:63 exceptions.handle(request, _('Unable to update the group.'))64 return False...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful