Best Python code snippet using tempest_python
test_agent.py
Source:test_agent.py
...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)133 def test_networks_on_dhcp_agent(self):134 self.assertRaises(135 base_policy.PolicyNotAuthorized,136 policy.enforce,137 self.context, "get_dhcp-networks", self.target)...
test_agents.py
Source:test_agents.py
...3"""4import unittest5from gocdapi_tests.systests.base import BaseSystemTest6class TestAgents(BaseSystemTest):7 def test_delete_agent(self):8 agent = self.go.agents.itervalues().next()9 agent.disable()10 agent.delete()11 self.assertTrue(agent not in self.go.agents)12 self.wait_for_agent_reconnection(agent.uuid)13 def test_enable_disable_agent(self):14 agent = self.go.agents.itervalues().next()15 agent.disable()16 self.assertFalse(agent.is_enabled())17 agent.enable()18 self.assertTrue(agent.is_enabled())19if __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!!