Best Python code snippet using tempest_python
test_types_client.py
Source:test_types_client.py  
...107            'tempest.lib.common.rest_client.RestClient.get',108            self.FAKE_DEFAULT_VOLUME_TYPE_INFO,109            to_utf=bytes_body,110            volume_type_id="6685584b-1eac-4da6-b5c3-555430cf68ff")111    def _test_show_default_volume_type(self, bytes_body=False):112        self.check_service_client_function(113            self.client.show_default_volume_type,114            'tempest.lib.common.rest_client.RestClient.get',115            self.FAKE_DEFAULT_VOLUME_TYPE_INFO,116            to_utf=bytes_body)117    def _test_create_volume_type(self, bytes_body=False):118        self.check_service_client_function(119            self.client.create_volume_type,120            'tempest.lib.common.rest_client.RestClient.post',121            self.FAKE_CREATE_VOLUME_TYPE,122            to_utf=bytes_body,123            name='volume-type-test')124    def _test_delete_volume_type(self):125        self.check_service_client_function(126            self.client.delete_volume_type,127            'tempest.lib.common.rest_client.RestClient.delete',128            {}, status=202,129            volume_type_id='6685584b-1eac-4da6-b5c3-555430cf68ff')130    def _test_list_volume_types_extra_specs(self, bytes_body=False):131        self.check_service_client_function(132            self.client.list_volume_types_extra_specs,133            'tempest.lib.common.rest_client.RestClient.get',134            self.FAKE_VOLUME_TYPE_EXTRA_SPECS,135            to_utf=bytes_body,136            volume_type_id='6685584b-1eac-4da6-b5c3-555430cf68ff')137    def _test_show_volume_type_extra_specs(self, bytes_body=False):138        self.check_service_client_function(139            self.client.show_volume_type_extra_specs,140            'tempest.lib.common.rest_client.RestClient.get',141            self.FAKE_SHOW_VOLUME_TYPE_EXTRA_SPECS,142            volume_type_id='6685584b-1eac-4da6-b5c3-555430cf68ff',143            extra_specs_name='capabilities',144            to_utf=bytes_body)145    def _test_create_volume_type_extra_specs(self, bytes_body=False):146        self.check_service_client_function(147            self.client.create_volume_type_extra_specs,148            'tempest.lib.common.rest_client.RestClient.post',149            self.FAKE_VOLUME_TYPE_EXTRA_SPECS,150            volume_type_id="6685584b-1eac-4da6-b5c3-555430cf68ff",151            extra_specs=self.FAKE_VOLUME_TYPE_EXTRA_SPECS,152            to_utf=bytes_body)153    def _test_delete_volume_type_extra_specs(self):154        self.check_service_client_function(155            self.client.delete_volume_type_extra_specs,156            'tempest.lib.common.rest_client.RestClient.delete',157            {}, status=202,158            volume_type_id='6685584b-1eac-4da6-b5c3-555430cf68ff',159            extra_spec_name='volume_backend_name')160    def _test_update_volume_type(self, bytes_body=False):161        self.check_service_client_function(162            self.client.update_volume_type,163            'tempest.lib.common.rest_client.RestClient.put',164            self.FAKE_UPDATE_VOLUME_TYPE,165            volume_type_id='6685584b-1eac-4da6-b5c3-555430cf68ff',166            to_utf=bytes_body,167            name='update-volume-type-test',168            description='test update volume type description')169    def _test_update_volume_type_extra_specs(self, bytes_body=False):170        self.check_service_client_function(171            self.client.update_volume_type_extra_specs,172            'tempest.lib.common.rest_client.RestClient.put',173            self.FAKE_SHOW_VOLUME_TYPE_EXTRA_SPECS,174            extra_spec_name='capabilities',175            volume_type_id='6685584b-1eac-4da6-b5c3-555430cf68ff',176            extra_specs=self.FAKE_SHOW_VOLUME_TYPE_EXTRA_SPECS,177            to_utf=bytes_body)178    def _test_add_type_access(self):179        self.check_service_client_function(180            self.client.add_type_access,181            'tempest.lib.common.rest_client.RestClient.post',182            {}, status=202,183            volume_type_id='6685584b-1eac-4da6-b5c3-555430cf68ff')184    def _test_remove_type_access(self):185        self.check_service_client_function(186            self.client.remove_type_access,187            'tempest.lib.common.rest_client.RestClient.post',188            {}, status=202,189            volume_type_id='6685584b-1eac-4da6-b5c3-555430cf68ff')190    def _test_list_type_access(self, bytes_body=False):191        self.check_service_client_function(192            self.client.list_type_access,193            'tempest.lib.common.rest_client.RestClient.get',194            self.FAKE_VOLUME_TYPE_ACCESS,195            volume_type_id='3c67e124-39ad-4ace-a507-8bb7bf510c26',196            to_utf=bytes_body)197    def test_list_volume_types_with_str_body(self):198        self._test_list_volume_types()199    def test_list_volume_types_with_bytes_body(self):200        self._test_list_volume_types(bytes_body=True)201    def test_show_volume_type_with_str_body(self):202        self._test_show_volume_type()203    def test_show_volume_type_with_bytes_body(self):204        self._test_show_volume_type(bytes_body=True)205    def test_show_default_volume_type_with_str_body(self):206        self._test_show_default_volume_type()207    def test_show_default_volume_type_with_bytes_body(self):208        self._test_show_default_volume_type(bytes_body=True)209    def test_create_volume_type_str_body(self):210        self._test_create_volume_type()211    def test_create_volume_type_with_bytes_body(self):212        self._test_create_volume_type(bytes_body=True)213    def test_list_volume_types_extra_specs_with_str_body(self):214        self._test_list_volume_types_extra_specs()215    def test_list_volume_types_extra_specs_with_bytes_body(self):216        self._test_list_volume_types_extra_specs(bytes_body=True)217    def test_show_volume_type_extra_specs_with_str_body(self):218        self._test_show_volume_type_extra_specs()219    def test_show_volume_type_extra_specs_with_bytes_body(self):220        self._test_show_volume_type_extra_specs(bytes_body=True)221    def test_create_volume_type_extra_specs_with_str_body(self):222        self._test_create_volume_type_extra_specs()...types_client.py
Source:types_client.py  
...52        resp, body = self.get(url)53        body = json.loads(body)54        self.validate_response(schema.show_volume_type, resp, body)55        return rest_client.ResponseBody(resp, body)56    def show_default_volume_type(self):57        """Returns the details of a single volume type.58        For a full list of available parameters, please refer to the official59        API reference:60        https://docs.openstack.org/api-ref/block-storage/v3/index.html#show-default-volume-type61        """62        url = "types/default"63        resp, body = self.get(url)64        body = json.loads(body)65        self.validate_response(schema.show_volume_type, resp, body)66        return rest_client.ResponseBody(resp, body)67    def create_volume_type(self, **kwargs):68        """Create volume type.69        For a full list of available parameters, please refer to the official70        API reference:...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!!
