Best Python code snippet using tempest_python
test_images_client.py
Source:test_images_client.py
...116 'tempest.lib.common.rest_client.RestClient.get',117 self.FAKE_CREATE_UPDATE_SHOW_IMAGE,118 bytes_body,119 image_id="e485aab9-0907-4973-921c-bb6da8a8fcf8")120 def _test_list_images(self, bytes_body=False):121 self.check_service_client_function(122 self.client.list_images,123 'tempest.lib.common.rest_client.RestClient.get',124 self.FAKE_LIST_IMAGES,125 bytes_body,126 mock_args=['images'])127 def test_create_image_with_str_body(self):128 self._test_create_image()129 def test_create_image_with_bytes_body(self):130 self._test_create_image(bytes_body=True)131 def test_update_image_with_str_body(self):132 self._test_update_image()133 def test_update_image_with_bytes_body(self):134 self._test_update_image(bytes_body=True)135 def test_deactivate_image(self):136 self.check_service_client_function(137 self.client.deactivate_image,138 'tempest.lib.common.rest_client.RestClient.post',139 {}, image_id="e485aab9-0907-4973-921c-bb6da8a8fcf8", status=204)140 def test_reactivate_image(self):141 self.check_service_client_function(142 self.client.reactivate_image,143 'tempest.lib.common.rest_client.RestClient.post',144 {}, image_id="e485aab9-0907-4973-921c-bb6da8a8fcf8", status=204)145 def test_delete_image(self):146 self.check_service_client_function(147 self.client.delete_image,148 'tempest.lib.common.rest_client.RestClient.delete',149 {}, image_id="e485aab9-0907-4973-921c-bb6da8a8fcf8", status=204)150 def test_store_image_file(self):151 data = six.BytesIO(data_utils.random_bytes())152 self.check_service_client_function(153 self.client.store_image_file,154 'tempest.lib.common.rest_client.RestClient.raw_request',155 {},156 image_id=self.FAKE_CREATE_UPDATE_SHOW_IMAGE["id"],157 status=204,158 data=data)159 def test_show_image_file(self):160 # NOTE: The response for this API returns raw binary data, but an error161 # is thrown if random bytes are used for the resp body since162 # ``create_response`` then calls ``json.dumps``.163 self.check_service_client_function(164 self.client.show_image_file,165 'tempest.lib.common.rest_client.RestClient.get',166 {},167 resp_as_string=True,168 image_id=self.FAKE_CREATE_UPDATE_SHOW_IMAGE["id"],169 headers={'Content-Type': 'application/octet-stream'},170 status=200)171 def test_add_image_tag(self):172 self.check_service_client_function(173 self.client.add_image_tag,174 'tempest.lib.common.rest_client.RestClient.put',175 {},176 image_id=self.FAKE_CREATE_UPDATE_SHOW_IMAGE["id"],177 status=204,178 tag=self.FAKE_TAG_NAME)179 def test_delete_image_tag(self):180 self.check_service_client_function(181 self.client.delete_image_tag,182 'tempest.lib.common.rest_client.RestClient.delete',183 {},184 image_id=self.FAKE_CREATE_UPDATE_SHOW_IMAGE["id"],185 status=204,186 tag=self.FAKE_TAG_NAME)187 def test_show_image_with_str_body(self):188 self._test_show_image()189 def test_show_image_with_bytes_body(self):190 self._test_show_image(bytes_body=True)191 def test_list_images_with_str_body(self):192 self._test_list_images()193 def test_list_images_with_bytes_body(self):...
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!!