How to use check_no_platform method in autotest

Best Python code snippet using autotest_python

rpc_interface.py

Source: rpc_interface.py Github

copy

Full Screen

...39def label_add_hosts(id, hosts):40 host_objs = models.Host.smart_get_bulk(hosts)41 label = models.Label.smart_get(id)42 if label.platform:43 models.Host.check_no_platform(host_objs)44 label.host_set.add(*host_objs)45def label_remove_hosts(id, hosts):46 host_objs = models.Host.smart_get_bulk(hosts)47 models.Label.smart_get(id).host_set.remove(*host_objs)48def get_labels(**filter_data):49 """\50 @returns A sequence of nested dictionaries of label information.51 """52 return rpc_utils.prepare_rows_as_nested_dicts(53 models.Label.query_objects(filter_data),54 ('atomic_group',))55# atomic groups56def add_atomic_group(name, max_number_of_machines=None, description=None):57 return models.AtomicGroup.add_object(58 name=name, max_number_of_machines=max_number_of_machines,59 description=description).id60def modify_atomic_group(id, **data):61 models.AtomicGroup.smart_get(id).update_object(data)62def delete_atomic_group(id):63 models.AtomicGroup.smart_get(id).delete()64def atomic_group_add_labels(id, labels):65 label_objs = models.Label.smart_get_bulk(labels)66 models.AtomicGroup.smart_get(id).label_set.add(*label_objs)67def atomic_group_remove_labels(id, labels):68 label_objs = models.Label.smart_get_bulk(labels)69 models.AtomicGroup.smart_get(id).label_set.remove(*label_objs)70def get_atomic_groups(**filter_data):71 return rpc_utils.prepare_for_serialization(72 models.AtomicGroup.list_objects(filter_data))73# hosts74def 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)102def host_remove_labels(id, labels):103 labels = models.Label.smart_get_bulk(labels)104 models.Host.smart_get(id).labels.remove(*labels)105def set_host_attribute(attribute, value, **host_filter_data):106 """107 @param attribute string name of attribute108 @param value string, or None to delete an attribute109 @param host_filter_data filter data to apply to Hosts to choose hosts to act110 upon111 """112 assert host_filter_data # disallow accidental actions on all hosts113 hosts = models.Host.query_objects(host_filter_data)114 models.AclGroup.check_for_acl_violation_hosts(hosts)...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

How To Handle Dynamic Dropdowns In Selenium WebDriver With Java

Joseph, who has been working as a Quality Engineer, was assigned to perform web automation for the company’s website.

QA Innovation – Using the senseshaping concept to discover customer needs

QA Innovation - Using the senseshaping concept to discover customer needsQA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.

11 Best Mobile Automation Testing Tools In 2022

Mobile application development is on the rise like never before, and it proportionally invites the need to perform thorough testing with the right mobile testing strategies. The strategies majorly involve the usage of various mobile automation testing tools. Mobile testing tools help businesses automate their application testing and cut down the extra cost, time, and chances of human error.

Agile in Distributed Development – A Formula for Success

Agile has unquestionable benefits. The mainstream method has assisted numerous businesses in increasing organizational flexibility as a result, developing better, more intuitive software. Distributed development is also an important strategy for software companies. It gives access to global talent, the use of offshore outsourcing to reduce operating costs, and round-the-clock development.

How To Get Started With Cypress Debugging

One of the most important tasks of a software developer is not just writing code fast; it is the ability to find what causes errors and bugs whenever you encounter one and the ability to solve them quickly.

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 autotest 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