def test_cut(polar, load_policy, query): set_frobbed([]) actor = Actor(name="guest") resource = Widget(id="1") action = "get" assert query(Predicate(name="allow_with_cut", args=[actor, action, resource])) assert get_frobbed() == ["Widget"] set_frobbed([]) resource = DooDad(id="2") assert query(Predicate(name="allow_with_cut", args=[actor, action, resource])) assert get_frobbed() == ["DooDad"]
def test_method_resolution_order(polar, load_policy, query): set_frobbed([]) actor = Actor(name="guest") resource = Widget(id="1") action = "get" assert query(Predicate(name="allow", args=[actor, action, resource])) assert get_frobbed() == ["Widget"] # DooDad is a Widget set_frobbed([]) resource = DooDad(id="2") assert query(Predicate(name="allow", args=[actor, action, resource])) assert get_frobbed() == ["DooDad", "Widget"]