Best Python code snippet using tempest_python
test_server_actions.py
Source:test_server_actions.py  
...131        resp, server = self.client.get_server(self.server_id)132        self.assertEqual(self.flavor_ref_alt, server['flavor']['id'])133    @attr(type='positive')134    @unittest.skipIf(not resize_available, 'Resize not available.')135    def test_resize_server_revert(self):136        """137        The server's RAM and disk space should return to its original138        values after a resize is reverted139        """140        resp, server = self.client.resize(self.server_id, self.flavor_ref_alt)141        self.assertEqual(202, resp.status)142        self.client.wait_for_server_status(self.server_id, 'VERIFY_RESIZE')143        self.client.revert_resize(self.server_id)144        self.client.wait_for_server_status(self.server_id, 'ACTIVE')145        # Need to poll for the id change until lp#924371 is fixed146        resp, server = self.client.get_server(self.server_id)147        start = int(time.time())148        while server['flavor']['id'] != self.flavor_ref:149            time.sleep(self.build_interval)...test_resize_server_revert.py
Source:test_resize_server_revert.py  
1"""2Copyright 2013 Rackspace3Licensed under the Apache License, Version 2.0 (the "License");4you may not use this file except in compliance with the License.5You may obtain a copy of the License at6    http://www.apache.org/licenses/LICENSE-2.07Unless required by applicable law or agreed to in writing, software8distributed under the License is distributed on an "AS IS" BASIS,9WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.10See the License for the specific language governing permissions and11limitations under the License.12"""13import unittest14from cloudcafe.common.tools.datagen import rand_name15from cloudroast.compute.instance_actions.api.test_resize_server_revert \16    import ResizeServerUpRevertTests, ResizeUpRevertBaseFixture17from cloudroast.compute.fixtures import ServerFromVolumeV1Fixture18@unittest.skip('Resize not enabled for boot from volume')19class ServerFromVolumeV1ResizeRevertTests(ServerFromVolumeV1Fixture,20                                          ResizeServerUpRevertTests):21    @classmethod22    def setUpClass(cls):23        super(ServerFromVolumeV1ResizeRevertTests, cls).setUpClass()24        response = cls.flavors_client.get_flavor_details(cls.flavor_ref)25        cls.flavor = response.entity26        cls.key = cls.keypairs_client.create_keypair(rand_name("key")).entity27        cls.resources.add(cls.key.name,28                          cls.keypairs_client.delete_keypair)29        cls.create_server(key_name=cls.key.name)...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!!
