Best Python code snippet using tempest_python
test_base.py
Source:test_base.py  
...109                         compute_images_client=mock.DEFAULT,110                         images=[], create=True)111    @mock.patch.object(waiters, 'wait_for_image_status',112                       side_effect=lib_exc.NotFound)113    def test_create_image_from_server_wait_until_saving_not_found(114            self, wait_for_image_status, compute_images_client):115        # Tests create_image_from_server with wait_until='SAVING' kwarg and116        # the a 404 is raised while waiting for the image status to change. In117        # this case we do not get the server details and just re-raise the 404.118        # setup mocks119        image_id = uuidutils.generate_uuid()120        fake_image = mock.Mock(response={'location': image_id})121        compute_images_client.create_image.return_value = fake_image122        # call the utility method123        self.assertRaises(124            lib_exc.NotFound,125            compute_base.BaseV2ComputeTest.create_image_from_server,126            mock.sentinel.server_id, wait_until='SAVING')127        # make our assertions...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!!
