Best Python code snippet using autotest_python
rpc_interface.py
Source:rpc_interface.py
...74def add_host(hostname, status=None, locked=None, protection=None):75 return models.Host.add_object(hostname=hostname, status=status,76 locked=locked, protection=protection).id77def modify_host(id, **data):78 rpc_utils.check_modify_host(data)79 host = models.Host.smart_get(id)80 rpc_utils.check_modify_host_locking(host, data)81 host.update_object(data)82def modify_hosts(host_filter_data, update_data):83 """84 @param host_filter_data: Filters out which hosts to modify.85 @param update_data: A dictionary with the changes to make to the hosts.86 """87 rpc_utils.check_modify_host(update_data)88 hosts = models.Host.query_objects(host_filter_data)89 for host in hosts:90 host.update_object(update_data)91def host_add_labels(id, labels):92 labels = models.Label.smart_get_bulk(labels)93 host = models.Host.smart_get(id)94 platforms = [label.name for label in labels if label.platform]95 if len(platforms) > 1:96 raise model_logic.ValidationError(97 {'labels': 'Adding more than one platform label: %s' %98 ', '.join(platforms)})99 if len(platforms) == 1:100 models.Host.check_no_platform([host])101 host.labels.add(*labels)...
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!!