def test_role_authorizer_is_role_accepted(idr_cache): authorizer = RolesAuthorizer(cache=idr_cache) assert authorizer.is_role_accepted(role="", auth_constraint_role=IDENTITY_OWNER) assert not authorizer.is_role_accepted(role=TRUSTEE, auth_constraint_role=IDENTITY_OWNER) assert not authorizer.is_role_accepted(role=None, auth_constraint_role=IDENTITY_OWNER) assert authorizer.is_role_accepted(role=TRUSTEE, auth_constraint_role=TRUSTEE) assert authorizer.is_role_accepted(role="", auth_constraint_role="*")
def test_role_authorizer_role_accepted_for_all_roles(idr_cache, req_auth): authorizer = RolesAuthorizer(cache=idr_cache) assert authorizer.is_role_accepted(req_auth, AuthConstraint(role="*", sig_count=1))
def test_role_authorizer_role_not_accepted(idr_cache, req_auth): authorizer = RolesAuthorizer(cache=idr_cache) assert not authorizer.is_role_accepted( req_auth, AuthConstraint(role="SomeOtherRole", sig_count=1))
def test_role_authorizer_is_role_accepted(idr_cache, req_auth): authorizer = RolesAuthorizer(cache=idr_cache) assert authorizer.is_role_accepted( req_auth, AuthConstraint(role=STEWARD, sig_count=1))