@pytest.mark.parametrize('actor,allow,expected', [(None, None, True), (None, {}, False), ({'id': 'root'}, {}, False), ({'id': 'root'}, True, True), (None, True, True), ({'id': 'root'}, False, False), (None, False, False), (None, {'unauthenticated': True}, True), (None, {'unauthenticated': False}, False), (None, {'id': 'root'}, False), ({'id': 'root'}, None, True), ({'id': 'simon', 'staff': True}, {'staff': True}, True), ({'id': 'simon', 'staff': False}, {'staff': True}, False), ({'id': 'root'}, {'id': '*'}, True), ({}, {'id': '*'}, False), ({'name': 'root'}, {'id': '*'}, False), ({'id': 'root'}, {'id': 'bob'}, False), ({'id': 'root'}, {'id': ['bob']}, False), ({'id': 'root'}, {'id': 'root'}, True), ({'id': 'root'}, {'id': ['root']}, True), ({'id': 'garry', 'roles': ['staff', 'dev']}, {'roles': ['staff']}, True), ({'id': 'garry', 'roles': ['staff', 'dev']}, {'roles': ['dev']}, True), ({'id': 'garry', 'roles': ['staff', 'dev']}, {'roles': ['otter']}, False), ({'id': 'garry', 'roles': ['staff', 'dev']}, {'roles': ['dev', 'otter']}, True), ({'id': 'garry', 'roles': []}, {'roles': ['staff']}, False), ({'id': 'garry'}, {'roles': ['staff']}, False), ({'id': 'root'}, {'bot_id': 'my-bot', 'id': ['root']}, True)])
def test_actor_matches_allow(actor, allow, expected):
    assert (expected == utils.actor_matches_allow(actor, allow))
@pytest.mark.parametrize('actor,allow,expected', [(None, None, True), (None, {}, False), ({'id': 'root'}, {}, False), ({'id': 'root'}, True, True), (None, True, True), ({'id': 'root'}, False, False), (None, False, False), (None, {'unauthenticated': True}, True), (None, {'unauthenticated': False}, False), (None, {'id': 'root'}, False), ({'id': 'root'}, None, True), ({'id': 'simon', 'staff': True}, {'staff': True}, True), ({'id': 'simon', 'staff': False}, {'staff': True}, False), ({'id': 'root'}, {'id': '*'}, True), ({}, {'id': '*'}, False), ({'name': 'root'}, {'id': '*'}, False), ({'id': 'root'}, {'id': 'bob'}, False), ({'id': 'root'}, {'id': ['bob']}, False), ({'id': 'root'}, {'id': 'root'}, True), ({'id': 'root'}, {'id': ['root']}, True), ({'id': 'garry', 'roles': ['staff', 'dev']}, {'roles': ['staff']}, True), ({'id': 'garry', 'roles': ['staff', 'dev']}, {'roles': ['dev']}, True), ({'id': 'garry', 'roles': ['staff', 'dev']}, {'roles': ['otter']}, False), ({'id': 'garry', 'roles': ['staff', 'dev']}, {'roles': ['dev', 'otter']}, True), ({'id': 'garry', 'roles': []}, {'roles': ['staff']}, False), ({'id': 'garry'}, {'roles': ['staff']}, False), ({'id': 'root'}, {'bot_id': 'my-bot', 'id': ['root']}, True)])
def test_actor_matches_allow(actor, allow, expected):
    assert (expected == utils.actor_matches_allow(actor, allow))