Best Python code snippet using tempest_python
servers.py
Source:servers.py
1# Licensed under the Apache License, Version 2.0 (the "License"); you may2# not use this file except in compliance with the License. You may obtain3# a copy of the License at4#5# http://www.apache.org/licenses/LICENSE-2.06#7# Unless required by applicable law or agreed to in writing, software8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the10# License for the specific language governing permissions and limitations11# under the License.12import copy13from tempest.lib.api_schema.response.compute.v2_58 import servers as servers25814# microversion 2.62 added hostId and host to the event, but only hostId is15# mandatory16show_instance_action = copy.deepcopy(servers258.show_instance_action)17show_instance_action['response_body']['properties']['instanceAction'][18 'properties']['events']['items'][19 'properties']['hostId'] = {'type': 'string'}20show_instance_action['response_body']['properties']['instanceAction'][21 'properties']['events']['items']['properties']['host'] = {'type': 'string'}22show_instance_action['response_body']['properties']['instanceAction'][23 'properties']['events']['items']['required'].append('hostId')24# Below are the unchanged schema in this microversion. We need25# to keep this schema in this file to have the generic way to select the26# right schema based on self.schema_versions_info mapping in service client.27list_servers = copy.deepcopy(servers258.list_servers)28show_server_diagnostics = copy.deepcopy(servers258.show_server_diagnostics)29get_remote_consoles = copy.deepcopy(servers258.get_remote_consoles)30list_tags = copy.deepcopy(servers258.list_tags)31update_all_tags = copy.deepcopy(servers258.update_all_tags)32delete_all_tags = copy.deepcopy(servers258.delete_all_tags)33check_tag_existence = copy.deepcopy(servers258.check_tag_existence)34update_tag = copy.deepcopy(servers258.update_tag)35delete_tag = copy.deepcopy(servers258.delete_tag)36get_server = copy.deepcopy(servers258.get_server)37list_servers_detail = copy.deepcopy(servers258.list_servers_detail)38update_server = copy.deepcopy(servers258.update_server)39rebuild_server = copy.deepcopy(servers258.rebuild_server)40rebuild_server_with_admin_pass = copy.deepcopy(41 servers258.rebuild_server_with_admin_pass)42attach_volume = copy.deepcopy(servers258.attach_volume)43show_volume_attachment = copy.deepcopy(servers258.show_volume_attachment)44list_volume_attachments = copy.deepcopy(servers258.list_volume_attachments)...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!