Best Python code snippet using tempest_python
test_agent.py
Source:test_agent.py
...25 self.context = self.system_admin_ctx26 def test_get_agent(self):27 self.assertTrue(28 policy.enforce(self.context, "get_agent", self.target))29 def test_update_agent(self):30 self.assertTrue(31 policy.enforce(self.context, "update_agent", self.target))32 def test_delete_agent(self):33 self.assertTrue(34 policy.enforce(self.context, "delete_agent", self.target))35 def test_add_network_to_dhcp_agent(self):36 self.assertTrue(37 policy.enforce(self.context,38 "create_dhcp-network",39 self.target))40 def test_get_networks_on_dhcp_agent(self):41 self.assertTrue(42 policy.enforce(self.context,43 "get_dhcp-networks", self.target))44 def test_delete_network_from_dhcp_agent(self):45 self.assertTrue(46 policy.enforce(self.context,47 "delete_dhcp-network",48 self.target))49 def test_add_router_to_l3_agent(self):50 self.assertTrue(51 policy.enforce(self.context,52 "create_l3-router",53 self.target))54 def test_get_routers_on_l3_agent(self):55 self.assertTrue(56 policy.enforce(self.context,57 "get_l3-routers", self.target))58 def test_delete_router_from_l3_agent(self):59 self.assertTrue(60 policy.enforce(self.context,61 "delete_l3-router",62 self.target))63 def test_get_dhcp_agents_hosting_network(self):64 self.assertTrue(65 policy.enforce(self.context,66 "get_dhcp-agents", self.target))67 def test_get_l3_agents_hosting_router(self):68 self.assertTrue(69 policy.enforce(self.context,70 "get_l3-agents", self.target))71class SystemMemberTests(SystemAdminTests):72 def setUp(self):73 super(SystemMemberTests, self).setUp()74 self.context = self.system_member_ctx75 def test_update_agent(self):76 self.assertRaises(77 base_policy.PolicyNotAuthorized,78 policy.enforce,79 self.context, "update_agent", self.target)80 def test_delete_agent(self):81 self.assertRaises(82 base_policy.PolicyNotAuthorized,83 policy.enforce,84 self.context, "delete_agent", self.target)85 def test_add_network_to_dhcp_agent(self):86 self.assertRaises(87 base_policy.PolicyNotAuthorized,88 policy.enforce,89 self.context, "create_dhcp-network", self.target)90 def test_delete_network_from_dhcp_agent(self):91 self.assertRaises(92 base_policy.PolicyNotAuthorized,93 policy.enforce,94 self.context, "delete_dhcp-network", self.target)95 def test_add_router_to_l3_agent(self):96 self.assertRaises(97 base_policy.PolicyNotAuthorized,98 policy.enforce,99 self.context, "create_l3-router", self.target)100 def test_delete_router_from_l3_agent(self):101 self.assertRaises(102 base_policy.PolicyNotAuthorized,103 policy.enforce,104 self.context, "delete_l3-router", self.target)105class SystemReaderTests(SystemMemberTests):106 def setUp(self):107 super(SystemReaderTests, self).setUp()108 self.context = self.system_reader_ctx109class ProjectAdminTests(AgentAPITestCase):110 def setUp(self):111 super(ProjectAdminTests, self).setUp()112 self.context = self.project_admin_ctx113 def test_get_agent(self):114 self.assertRaises(115 base_policy.PolicyNotAuthorized,116 policy.enforce,117 self.context, "get_agent", self.target)118 def test_update_agent(self):119 self.assertRaises(120 base_policy.PolicyNotAuthorized,121 policy.enforce,122 self.context, "update_agent", self.target)123 def test_delete_agent(self):124 self.assertRaises(125 base_policy.PolicyNotAuthorized,126 policy.enforce,127 self.context, "delete_agent", self.target)128 def test_add_network_to_dhcp_agent(self):129 self.assertRaises(130 base_policy.PolicyNotAuthorized,131 policy.enforce,132 self.context, "create_dhcp-network", self.target)...
tests_agentBuilder.py
Source:tests_agentBuilder.py
1import sys, os2myPath = os.path.dirname(os.path.abspath(__file__))3sys.path.insert(0, myPath + '/../')4from config import appconf5import unittest6from app.agent.agentBuilder import build_agent, deploy_Agent, update_agent7class AgentTest(unittest.TestCase):8 def test_Update_agent(self):9 update_agent(agent_name="127.0.0.1", broker_address=appconf().BROKERADDRESS)10 def test_Build_agent(self):11 build_agent()12 def test_Deploy_Agent(self):13 deploy_Agent(agent_name="127.0.0.1", password="pascal", hostname="127.0.0.1", login=appconf().REMOTEUSERNAME, broker_address=appconf().BROKERADDRESS, pub_key_file=appconf().PUBKEYFILE)14if __name__ == '__main__':...
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!!