Best Python code snippet using tempest_python
test_transfers_client.py
Source:test_transfers_client.py
...62 to_utf=bytes_body,63 status=202,64 mock_args=['os-volume-transfer', payload],65 **kwargs)66 def _test_accept_volume_transfer(self, bytes_body=False):67 resp_body = copy.deepcopy(self.FAKE_VOLUME_TRANSFER_INFO)68 resp_body['transfer'].pop('created_at')69 kwargs = {"auth_key": "fake-auth-key"}70 payload = json.dumps({"accept": kwargs}, sort_keys=True)71 json_dumps = json.dumps72 # NOTE: Use sort_keys for json.dumps so that the expected and actual73 # payloads are guaranteed to be identical for mock_args assert check.74 with mock.patch.object(transfers_client.json, 'dumps') as mock_dumps:75 mock_dumps.side_effect = lambda d: json_dumps(d, sort_keys=True)76 self.check_service_client_function(77 self.client.accept_volume_transfer,78 'tempest.lib.common.rest_client.RestClient.post',79 resp_body,80 to_utf=bytes_body,81 status=202,82 mock_args=['os-volume-transfer/%s/accept' %83 self.FAKE_VOLUME_TRANSFER_ID, payload],84 transfer_id=self.FAKE_VOLUME_TRANSFER_ID,85 **kwargs)86 def _test_show_volume_transfer(self, bytes_body=False):87 resp_body = self.FAKE_VOLUME_TRANSFER_INFO88 self.check_service_client_function(89 self.client.show_volume_transfer,90 'tempest.lib.common.rest_client.RestClient.get',91 resp_body,92 to_utf=bytes_body,93 transfer_id="0e89cdd1-6249-421b-96d8-25fac0623d42")94 def _test_list_volume_transfers(self, detail=False, bytes_body=False):95 resp_body = copy.deepcopy(self.FAKE_VOLUME_TRANSFER_INFO)96 if not detail:97 resp_body['transfer'].pop('created_at')98 resp_body = {"transfers": [resp_body['transfer']]}99 self.check_service_client_function(100 self.client.list_volume_transfers,101 'tempest.lib.common.rest_client.RestClient.get',102 resp_body,103 to_utf=bytes_body,104 detail=detail)105 def test_create_volume_transfer_with_str_body(self):106 self._test_create_volume_transfer()107 def test_create_volume_transfer_with_bytes_body(self):108 self._test_create_volume_transfer(bytes_body=True)109 def test_accept_volume_transfer_with_str_body(self):110 self._test_accept_volume_transfer()111 def test_accept_volume_transfer_with_bytes_body(self):112 self._test_accept_volume_transfer(bytes_body=True)113 def test_show_volume_transfer_with_str_body(self):114 self._test_show_volume_transfer()115 def test_show_volume_transfer_with_bytes_body(self):116 self._test_show_volume_transfer(bytes_body=True)117 def test_list_volume_transfers_with_str_body(self):118 self._test_list_volume_transfers()119 def test_list_volume_transfers_with_bytes_body(self):120 self._test_list_volume_transfers(bytes_body=True)121 def test_list_volume_transfers_with_detail_with_str_body(self):122 self._test_list_volume_transfers(detail=True)123 def test_list_volume_transfers_with_detail_with_bytes_body(self):124 self._test_list_volume_transfers(detail=True, bytes_body=True)125 def test_delete_volume_transfer(self):126 self.check_service_client_function(...
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!!