+ self.assertFalse(weird('blackneb'))
+ self.assertTrue(weird('crow'))
+
+ def test_compound_acls_disjunction(self):
+ a_b_c = acl.StringWildcardBasedACL(
+ allowed_patterns = ['a*', 'b*', 'c*'],
+ order_to_check_allow_deny = acl.Order.ALLOW_DENY,
+ default_answer = False
+ )
+ c_d_e = acl.StringWildcardBasedACL(
+ allowed_patterns = ['c*', 'd*', 'e*'],
+ order_to_check_allow_deny = acl.Order.ALLOW_DENY,
+ default_answer = False
+ )
+ disjunction = acl.AnyCompoundACL(
+ subacls = [a_b_c, c_d_e],
+ order_to_check_allow_deny = acl.Order.ALLOW_DENY,
+ default_answer = False,
+ )
+ self.assertTrue(disjunction('aardvark'))
+ self.assertTrue(disjunction('caribou'))
+ self.assertTrue(disjunction('eagle'))
+ self.assertFalse(disjunction('newt'))
+
+ def test_compound_acls_conjunction(self):
+ a_b_c = acl.StringWildcardBasedACL(
+ allowed_patterns = ['a*', 'b*', 'c*'],
+ order_to_check_allow_deny = acl.Order.ALLOW_DENY,
+ default_answer = False
+ )
+ c_d_e = acl.StringWildcardBasedACL(
+ allowed_patterns = ['c*', 'd*', 'e*'],
+ order_to_check_allow_deny = acl.Order.ALLOW_DENY,
+ default_answer = False
+ )
+ conjunction = acl.AllCompoundACL(
+ subacls = [a_b_c, c_d_e],
+ order_to_check_allow_deny = acl.Order.ALLOW_DENY,
+ default_answer = False,
+ )
+ self.assertFalse(conjunction('aardvark'))
+ self.assertTrue(conjunction('caribou'))
+ self.assertTrue(conjunction('condor'))
+ self.assertFalse(conjunction('eagle'))
+ self.assertFalse(conjunction('newt'))