How to use _get_rule_application method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

metadatapolicy.py

Source:metadatapolicy.py Github

copy

Full Screen

...12 self._disallow_unknown_tags = False13 def has_constraints(self):14 return self._properties or self._tags or self._disallow_unknown_properties or self._disallow_unknown_tags15 @staticmethod16 def _get_rule_application(on_test, on_suite):17 if on_test is None and on_suite is None:18 return True, False19 if not on_test and not on_suite:20 raise AssertionError("either on_test or on_suite need to be True")21 return bool(on_test), bool(on_suite)22 def add_property_rule(self, prop_name, accepted_values=None, on_test=None, on_suite=None, required=False):23 """24 Declare a property rule.25 :param prop_name: the property name26 :param accepted_values: an optional list of accepted values27 :param on_test: whether or not the property can be used on a test28 :param on_suite: whether or not the property can be used on a suite29 :param required: whether or not the property is required30 If neither on_test or on_suite argument are set, then the property is only available for tests.31 """32 on_test, on_suite = self._get_rule_application(on_test, on_suite)33 self._properties[prop_name] = {34 "values": accepted_values,35 "on_test": on_test,36 "on_suite": on_suite,37 "required": required38 }39 def disallow_unknown_properties(self):40 """41 Disallow unknown properties for tests and suites.42 """43 self._disallow_unknown_properties = True44 def add_tag_rule(self, tag_name, on_test=None, on_suite=None):45 """46 Declare a tag rule.47 :param tag_name: the tag name48 :param on_test: whether or not the tag can be used on a test49 :param on_suite: whether or not the tag can be used on a suite50 If neither on_test or on_suite argument are set, then the tag is only available for tests.51 """52 tag_names = tag_name if type(tag_name) in (list, tuple) else [tag_name]53 for tag_name in tag_names:54 on_test, on_suite = self._get_rule_application(on_test, on_suite)55 self._tags[tag_name] = {56 "on_test": on_test,57 "on_suite": on_suite58 }59 def disallow_unknown_tags(self):60 """61 Disallow unknown tags for tests and suites.62 """63 self._disallow_unknown_tags = True64 def _check_compliance(self, obj, obj_type,65 available_properties, forbidden_properties,66 available_tags, forbidden_tags):67 # check unknown properties68 if self._disallow_unknown_properties:...

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