Best Python code snippet using tempest_python
test_cli20_l7policy.py
Source:test_cli20_l7policy.py
...49 api_args[args_conf[arg][0]] = kwargs[arg]50 else:51 api_args[args_conf[arg][0]] = args_conf[arg][2]52 return cli_args, api_args53 def _test_create_policy(self, *args, **kwargs):54 resource = 'l7policy'55 cmd_resource = 'lbaas_l7policy'56 cmd = l7policy.CreateL7Policy(test_cli20.MyApp(sys.stdout), None)57 cli_args, api_args = self._get_test_args(*args, **kwargs)58 position_names = list(api_args.keys())59 position_values = list(api_args.values())60 self._test_create_resource(resource, cmd, None, 'test_id',61 cli_args, position_names, position_values,62 cmd_resource=cmd_resource)63 def _test_update_policy(self, *args, **kwargs):64 resource = 'l7policy'65 cmd_resource = 'lbaas_l7policy'66 cmd = l7policy.UpdateL7Policy(test_cli20.MyApp(sys.stdout), None)67 cli_args, api_args = self._get_test_args(*args, **kwargs)68 cli_args.append('test_id')69 self._test_update_resource(resource, cmd, 'test_id',70 cli_args, api_args,71 cmd_resource=cmd_resource)72 def test_create_policy_with_mandatory_params(self):73 # lbaas-l7policy-create with mandatory params only.74 self._test_create_policy('action', 'listener')75 def test_create_policy_with_all_params(self):76 # lbaas-l7policy-create REJECT policy.77 self._test_create_policy('name', 'description',78 'action', 'listener',79 'position')80 def test_create_disabled_policy(self):81 # lbaas-l7policy-create disabled REJECT policy.82 self._test_create_policy('action', 'listener', 'admin-state-down')83 def test_create_url_redirect_policy(self):84 # lbaas-l7policy-create REDIRECT_TO_URL policy.85 self._test_create_policy('name', 'description',86 'action', 'listener',87 'redirect-url',88 action='REDIRECT_TO_URL')89 def test_create_url_redirect_policy_no_url(self):90 # lbaas-l7policy-create REDIRECT_TO_URL policy without url argument.91 self.assertRaises(exceptions.CommandError,92 self._test_create_policy,93 'name', 'description',94 'action', 'listener',95 action='REDIRECT_TO_URL')96 def test_create_pool_redirect_policy(self):97 # lbaas-l7policy-create REDIRECT_TO_POOL policy.98 self._test_create_policy('name', 'description',99 'action', 'listener',100 'redirect-pool',101 action='REDIRECT_TO_POOL')102 def test_create_pool_redirect_policy_no_pool(self):103 # lbaas-l7policy-create REDIRECT_TO_POOL policy without pool argument.104 self.assertRaises(exceptions.CommandError,105 self._test_create_policy,106 'name', 'description',107 'action', 'listener',108 action='REDIRECT_TO_POOL')109 def test_create_reject_policy_with_url(self):110 # lbaas-l7policy-create REJECT policy while specifying url argument.111 self.assertRaises(exceptions.CommandError,112 self._test_create_policy,...
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!!