Best Python code snippet using tempest_python
test_access.py
Source:test_access.py
...24 ("MyPolicy Network", "somerulename", "", {}),25 ("MyPolicy Threat", "", "someruleuid", {}),26 ("MyPolicy Network", "", "", {"rule-number": 1}),27])28def test_show_access_rule(core_client, mgmt_server_base_uri, layer, name, uid, params):29 endpoint = mgmt_server_base_uri + 'show-access-rule'30 with responses.RequestsMock() as rsps:31 resp_body = {'foo': 'bar', 'message': 'OK'}32 rsps.add(responses.POST, endpoint,33 json=resp_body, status=200,34 content_type='application/json')35 ar = cpauto.AccessRule(core_client)36 r = ar.show(layer=layer, name=name, uid=uid, params=params)37 assert r.status_code == 20038 assert r.json() == resp_body39@pytest.mark.parametrize("layer,name,uid,params", [40 ("MyPolicy Network", "somerulename", "", {"enabled": False}),41 ("MyPolicy Threat", "", "someruleuid", {"action": "Drop"}),42 ("MyPolicy Network", "", "", {"rule-number": 1, "new-name": "first rule"}),...
test_access_rule.py
Source:test_access_rule.py
...37 assert resp.uid == "1df8a4b0-fa8b-428b-b649-626b74bf7f81"38 assert resp.name == "Rule 1"39 assert resp.action.name == "Drop"40@responses.activate41def test_show_access_rule(management, resp_access_rule):42 responses.add(43 responses.POST,44 url="https://127.0.0.1:443/web_api/v1.5/show-access-rule",45 json=resp_access_rule,46 status=200,47 )48 resp = management.access_control_nat.access_rule.show(49 uid="1df8a4b0-fa8b-428b-b649-626b74bf7f81",50 layer="MyLayer",51 show_as_ranges=False,52 show_hits=True,53 hits_settings="",54 )55 assert resp.uid == "1df8a4b0-fa8b-428b-b649-626b74bf7f81"...
test_access_rules.py
Source:test_access_rules.py
...50 def test_list_access_rules(self):51 ar = self.non_admin_access_rules_client.list_access_rules(self.user_id)52 self.assertEqual(1, len(ar['access_rules']))53 @decorators.idempotent_id('795dd507-ca1e-40e9-ba90-ff0a08689ba4')54 def test_show_access_rule(self):55 access_rule_id = self.app_cred['access_rules'][0]['id']56 self.non_admin_access_rules_client.show_access_rule(57 self.user_id, access_rule_id)58 @decorators.idempotent_id('278757e9-e193-4bf8-adf2-0b0a229a17d0')59 def test_delete_access_rule(self):60 access_rule_id = self.app_cred['access_rules'][0]['id']61 app_cred_id = self.app_cred['id']62 self.assertRaises(63 lib_exc.Forbidden,64 self.non_admin_access_rules_client.delete_access_rule,65 self.user_id,66 access_rule_id)67 self.non_admin_app_creds_client.delete_application_credential(68 self.user_id, app_cred_id)...
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!!