Best Python code snippet using tempest_python
test_metering.py
Source:test_metering.py
...58 self.context, 'get_metering_label_rule', self.target))59 self.assertTrue(60 policy.enforce(61 self.context, 'get_metering_label_rule', self.alt_target))62 def test_delete_metering_label_rule(self):63 self.assertTrue(64 policy.enforce(65 self.context, 'delete_metering_label_rule', self.target))66 self.assertTrue(67 policy.enforce(68 self.context, 'delete_metering_label_rule', self.alt_target))69class SystemMemberTests(SystemAdminTests):70 def setUp(self):71 super(SystemMemberTests, self).setUp()72 self.context = self.system_member_ctx73 def test_create_metering_label(self):74 self.assertRaises(75 base_policy.PolicyNotAuthorized,76 policy.enforce,77 self.context, 'create_metering_label', self.target)78 self.assertRaises(79 base_policy.PolicyNotAuthorized,80 policy.enforce,81 self.context, 'create_metering_label', self.alt_target)82 def test_delete_metering_label(self):83 self.assertRaises(84 base_policy.PolicyNotAuthorized,85 policy.enforce,86 self.context, 'delete_metering_label', self.target)87 self.assertRaises(88 base_policy.PolicyNotAuthorized,89 policy.enforce,90 self.context, 'delete_metering_label', self.alt_target)91 def test_create_metering_label_rule(self):92 self.assertRaises(93 base_policy.PolicyNotAuthorized,94 policy.enforce,95 self.context, 'create_metering_label_rule', self.target)96 self.assertRaises(97 base_policy.PolicyNotAuthorized,98 policy.enforce,99 self.context, 'create_metering_label_rule', self.alt_target)100 def test_delete_metering_label_rule(self):101 self.assertRaises(102 base_policy.PolicyNotAuthorized,103 policy.enforce,104 self.context, 'delete_metering_label_rule', self.target)105 self.assertRaises(106 base_policy.PolicyNotAuthorized,107 policy.enforce,108 self.context, 'delete_metering_label_rule', self.alt_target)109class SystemReaderTests(SystemMemberTests):110 def setUp(self):111 super(SystemReaderTests, self).setUp()112 self.context = self.system_reader_ctx113class ProjectAdminTests(MeteringAPITestCase):114 def setUp(self):115 super(ProjectAdminTests, self).setUp()116 self.context = self.project_admin_ctx117 def test_create_metering_label(self):118 self.assertRaises(119 base_policy.PolicyNotAuthorized,120 policy.enforce,121 self.context, 'create_metering_label', self.target)122 self.assertRaises(123 base_policy.PolicyNotAuthorized,124 policy.enforce,125 self.context, 'create_metering_label', self.alt_target)126 def test_get_metering_label(self):127 self.assertRaises(128 base_policy.PolicyNotAuthorized,129 policy.enforce,130 self.context, 'get_metering_label', self.target)131 self.assertRaises(132 base_policy.PolicyNotAuthorized,133 policy.enforce,134 self.context, 'get_metering_label', self.alt_target)135 def test_delete_metering_label(self):136 self.assertRaises(137 base_policy.PolicyNotAuthorized,138 policy.enforce,139 self.context, 'delete_metering_label', self.target)140 self.assertRaises(141 base_policy.PolicyNotAuthorized,142 policy.enforce,143 self.context, 'delete_metering_label', self.alt_target)144 def test_create_metering_label_rule(self):145 self.assertRaises(146 base_policy.PolicyNotAuthorized,147 policy.enforce,148 self.context, 'create_metering_label_rule', self.target)149 self.assertRaises(150 base_policy.PolicyNotAuthorized,151 policy.enforce,152 self.context, 'create_metering_label_rule', self.alt_target)153 def test_get_metering_label_rule(self):154 self.assertRaises(155 base_policy.PolicyNotAuthorized,156 policy.enforce,157 self.context, 'get_metering_label_rule', self.target)158 self.assertRaises(159 base_policy.PolicyNotAuthorized,160 policy.enforce,161 self.context, 'get_metering_label_rule', self.alt_target)162 def test_delete_metering_label_rule(self):163 self.assertRaises(164 base_policy.PolicyNotAuthorized,165 policy.enforce,166 self.context, 'delete_metering_label_rule', self.target)167 self.assertRaises(168 base_policy.PolicyNotAuthorized,169 policy.enforce,170 self.context, 'delete_metering_label_rule', self.alt_target)171class ProjectMemberTests(ProjectAdminTests):172 def setUp(self):173 super(ProjectMemberTests, self).setUp()174 self.context = self.project_member_ctx175class ProjectReaderTests(ProjectMemberTests):176 def setUp(self):...
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!!