def test_is_acl_allowed_returns_true(self): self.assertTrue(is_acl_allowed("bob", {"engineering_ops"})) self.assertTrue(is_acl_allowed("alice", {"engineering_ops"})) self.assertTrue(is_acl_allowed("eve", {"engineering_devs"})) self.assertTrue( is_acl_allowed("eve", {"engineering_ops", "engineering_devs"})) self.assertTrue( is_acl_allowed("alice", {"engineering_ops", "engineering_devs"}))
def message_is_allowed(self, message, acl): nick = self.get_user_from_message(message)['nick'] return is_acl_allowed(nick, acl)
def test_is_acl_allowed_returns_false(self): self.assertFalse(is_acl_allowed("eve", {"engineering_ops"})) self.assertFalse(is_acl_allowed("bob", {"engineering_devs"})) self.assertFalse(is_acl_allowed("alice", {"engineering_devs"})) self.assertFalse(is_acl_allowed("bob", {"empty_acl"}))
def test_is_acl_allowed_returns_true(self): self.assertTrue(is_acl_allowed("bob", {"engineering_ops"})) self.assertTrue(is_acl_allowed("alice", {"engineering_ops"})) self.assertTrue(is_acl_allowed("eve", {"engineering_devs"})) self.assertTrue(is_acl_allowed("eve", {"engineering_ops", "engineering_devs"})) self.assertTrue(is_acl_allowed("alice", {"engineering_ops", "engineering_devs"}))
def test_is_acl_allowed_returns_false(not_allowed_message_with_acls): message, acls = not_allowed_message_with_acls assert not is_acl_allowed(message.sender.id, acls)
def test_is_acl_allowed_returns_true(allowed_message_with_acls): message, acls = allowed_message_with_acls assert is_acl_allowed(message.sender.id, acls)