How to use _test_host_data method in tempest

Best Python code snippet using tempest_python

test_hosts_client.py

Source:test_hosts_client.py Github

copy

Full Screen

...65 self.params = {'hostname': self.HOST_ID}66 self.func2mock = {67 'get': 'tempest.common.service_client.ServiceClient.get',68 'put': 'tempest.common.service_client.ServiceClient.put'}69 def _test_host_data(self, test_type='list', bytes_body=False):70 expected_resp = self.HOST_DATA71 if test_type != 'list':72 function_call = self.client.show_host73 else:74 expected_resp = self.HOSTS_DATA75 function_call = self.client.list_hosts76 self.params = {'host_name': self.HOST_ID}77 self.check_service_client_function(78 function_call, self.func2mock['get'],79 expected_resp, bytes_body,80 200, **self.params)81 def _test_update_hosts(self, bytes_body=False):82 expected_resp = self.ENABLE_HOST_DATA83 self.check_service_client_function(84 self.client.update_host, self.func2mock['put'],85 expected_resp, bytes_body,86 200, **self.params)87 def _test_control_host(self, control_op='reboot', bytes_body=False):88 if control_op == 'start':89 expected_resp = self.FAKE_CONTROL_DATA['startup']90 function_call = self.client.startup_host91 elif control_op == 'stop':92 expected_resp = self.FAKE_CONTROL_DATA['shutdown']93 function_call = self.client.shutdown_host94 else:95 expected_resp = self.FAKE_CONTROL_DATA['reboot']96 function_call = self.client.reboot_host97 self.check_service_client_function(98 function_call, self.func2mock['get'],99 expected_resp, bytes_body,100 200, **self.params)101 def test_show_host_with_str_body(self):102 self._test_host_data('show')103 def test_show_host_with_bytes_body(self):104 self._test_host_data('show', True)105 def test_list_host_with_str_body(self):106 self._test_host_data()107 def test_list_host_with_bytes_body(self):108 self._test_host_data(bytes_body=True)109 def test_start_host_with_str_body(self):110 self._test_control_host('start')111 def test_start_host_with_bytes_body(self):112 self._test_control_host('start', True)113 def test_stop_host_with_str_body(self):114 self._test_control_host('stop')115 def test_stop_host_with_bytes_body(self):116 self._test_control_host('stop', True)117 def test_reboot_host_with_str_body(self):118 self._test_control_host('reboot')119 def test_reboot_host_with_bytes_body(self):120 self._test_control_host('reboot', True)121 def test_update_host_with_str_body(self):122 self._test_update_hosts()...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful