Best Python code snippet using autotest_python
action_common_unittest.py
Source:action_common_unittest.py
...15 orig_checks = {'name__in': ['item0', 'item1']}16 mytest = action_common.atest_list()17 filters = copy.deepcopy(orig_filters)18 checks = copy.deepcopy(orig_checks)19 mytest.check_for_wildcard(filters, checks)20 self.assertEqual(filters, orig_filters)21 self.assertEqual(checks, orig_checks)22 def test_check_for_wilcard_none_list(self):23 orig_filters = {'name__in': ['item0']}24 orig_checks = {'name__in': ['item0']}25 mytest = action_common.atest_list()26 filters = copy.deepcopy(orig_filters)27 checks = copy.deepcopy(orig_checks)28 mytest.check_for_wildcard(filters, checks)29 self.assertEqual(filters, orig_filters)30 self.assertEqual(checks, orig_checks)31 def test_check_for_wilcard_one_list(self):32 filters = {'something__in': ['item*']}33 checks = {'something__in': ['item*']}34 mytest = action_common.atest_list()35 mytest.check_for_wildcard(filters, checks)36 self.assertEqual(filters, {'something__startswith': 'item'})37 self.assertEqual(checks, {'something__startswith': None})38 def test_check_for_wilcard_one_string(self):39 filters = {'something__name': 'item*'}40 checks = {'something__name': 'item*'}41 mytest = action_common.atest_list()42 mytest.check_for_wildcard(filters, checks)43 self.assertEqual(filters, {'something__name__startswith': 'item'})44 self.assertEqual(checks, {'something__name__startswith': None})45 def test_check_for_wilcard_one_string_login(self):46 filters = {'something__login': 'item*'}47 checks = {'something__login': 'item*'}48 mytest = action_common.atest_list()49 mytest.check_for_wildcard(filters, checks)50 self.assertEqual(filters, {'something__login__startswith': 'item'})51 self.assertEqual(checks, {'something__login__startswith': None})52 def test_check_for_wilcard_two(self):53 orig_filters = {'something__in': ['item0*', 'item1*']}54 orig_checks = {'something__in': ['item0*', 'item1*']}55 mytest = action_common.atest_list()56 filters = copy.deepcopy(orig_filters)57 checks = copy.deepcopy(orig_checks)58 self.god.stub_function(sys, 'exit')59 sys.exit.expect_call(1).and_raises(cli_mock.ExitException)60 self.god.mock_io()61 self.assertRaises(cli_mock.ExitException,62 mytest.check_for_wildcard, filters, checks)63 (out, err) = self.god.unmock_io()...
run_parliament.py
Source:run_parliament.py
...38 return all_policies39def run_parliament(policy_json, policy_name):40 policy = Policy(policy_json)41 policy.analyze()42 check_for_wildcard(policy)43 44 # Assign finding details45 findings = [46 {47 "issue": finding.issue,48 "title": finding.title,49 "severity": finding.severity,50 "description": finding.description,51 "detail": finding.detail,52 "location": finding.location,53 "policy_name": policy_name54 }55 for finding in policy.findings56 ]...
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!!