Lines Matching refs:rule
158 rule = pyhbac.HbacRule(name)
159 self.assertEqual(rule.name, unicode(name))
161 rule.name = new_name
162 self.assertEqual(rule.name, unicode(new_name))
165 rule = pyhbac.HbacRule("testRuleGetSetEnabled")
167 rule.enabled = True
168 self.assertEqual(rule.enabled, True)
169 rule.enabled = False
170 self.assertEqual(rule.enabled, False)
172 rule.enabled = "TRUE"
173 self.assertEqual(rule.enabled, True)
174 rule.enabled = "FALSE"
175 self.assertEqual(rule.enabled, False)
177 rule.enabled = "true"
178 self.assertEqual(rule.enabled, True)
179 rule.enabled = "false"
180 self.assertEqual(rule.enabled, False)
182 rule.enabled = "True"
183 self.assertEqual(rule.enabled, True)
184 rule.enabled = "False"
185 self.assertEqual(rule.enabled, False)
187 rule.enabled = 1
188 self.assertEqual(rule.enabled, True)
189 rule.enabled = 0
190 self.assertEqual(rule.enabled, False)
193 self.assertRaises(TypeError, rule.__setattr__, "enabled", None)
194 self.assertRaises(TypeError, rule.__setattr__, "enabled", [])
195 self.assertRaises(ValueError, rule.__setattr__, "enabled", "foo")
196 self.assertRaises(ValueError, rule.__setattr__, "enabled", 5)
202 # rule should contain empty elements after instantiation
203 rule = pyhbac.HbacRule("testRuleElement")
204 self.assertIsInstance(rule.users, pyhbac.HbacRuleElement)
205 self.assertIsInstance(rule.services, pyhbac.HbacRuleElement)
206 self.assertIsInstance(rule.targethosts, pyhbac.HbacRuleElement)
207 self.assertIsInstance(rule.srchosts, pyhbac.HbacRuleElement)
209 self.assertIsInstance(rule.users.names, list)
210 self.assertIsInstance(rule.users.groups, list)
211 self.assertCountEqual(rule.users.names, [])
212 self.assertCountEqual(rule.users.groups, [])
216 rule = pyhbac.HbacRule("testRuleElement")
217 rule.users = user_el
218 self.assertCountEqual(rule.users.names, users)
219 self.assertCountEqual(rule.users.groups, user_groups)
222 rule = pyhbac.HbacRule("testRuleElement")
223 rule.users.names = users
224 rule.users.groups = user_groups
225 self.assertCountEqual(rule.users.names, users)
226 self.assertCountEqual(rule.users.groups, user_groups)
235 rule = pyhbac.HbacRule("testRuleElement")
236 rule.users = el
237 return rule
239 rule = _get_rule()
240 self.assertCountEqual(rule.users.names, ["foo", "bar"])
241 self.assertCountEqual(rule.users.groups, ["abc", "def"])
398 # Test that an allow rule on its own allows access
403 # Test that a user not in the rule is not allowed
410 # But allows if the rule is an ALL rule
473 # catch invalid rule type