diff --git a/.regal/config.yaml b/.regal/config.yaml index ee64004..1df352e 100644 --- a/.regal/config.yaml +++ b/.regal/config.yaml @@ -3,3 +3,7 @@ rules: no-defined-entrypoint: # This repo consists of a set of library functions, which therefore have no entrypoint. level: ignore + style: + line-length: + # This repo consists of references to deeply-nested data variables. + level: ignore diff --git a/src/abbey/functions/expire_after_test.rego b/src/abbey/functions/expire_after_test.rego index 85addf6..1190b36 100644 --- a/src/abbey/functions/expire_after_test.rego +++ b/src/abbey/functions/expire_after_test.rego @@ -1,18 +1,19 @@ package abbey.functions_test +import data.abbey.functions import future.keywords.if test_after_expired_duration if { - not expire_after("1m") with data.system.abbey.target.grant.approved_at as "2023-01-01T01:00:00Z" + not functions.expire_after("1m") with data.system.abbey.target.grant.approved_at as "2023-01-01T01:00:00Z" with time.now_ns as 1672534900000000000 } test_at_expired_duration if { - not expire_after("1m") with data.system.abbey.target.grant.approved_at as "2023-01-01T01:00:00Z" + not functions.expire_after("1m") with data.system.abbey.target.grant.approved_at as "2023-01-01T01:00:00Z" with time.now_ns as 1672534860000000000 } test_before_expired_duration if { - expire_after("1m") with data.system.abbey.target.grant.approved_at as "2023-01-01T01:00:00Z" + functions.expire_after("1m") with data.system.abbey.target.grant.approved_at as "2023-01-01T01:00:00Z" with time.now_ns as 0 } diff --git a/src/abbey/functions/expire_at_test.rego b/src/abbey/functions/expire_at_test.rego index 058117f..20ee959 100644 --- a/src/abbey/functions/expire_at_test.rego +++ b/src/abbey/functions/expire_at_test.rego @@ -1,18 +1,19 @@ package abbey.functions_test +import data.abbey.functions import future.keywords.if test_after_expired_at_threshold if { - not expire_at("2023-01-01T02:00:00Z") with data.system.abbey.target.grant.approved_at as "2023-01-01T01:00:00Z" + not functions.expire_at("2023-01-01T02:00:00Z") with data.system.abbey.target.grant.approved_at as "2023-01-01T01:00:00Z" with time.now_ns as 1672538500000000000 } test_on_expired_at_threshold if { - not expire_at("2023-01-01T01:00:00Z") with data.system.abbey.target.grant.approved_at as "2023-01-01T01:00:00Z" + not functions.expire_at("2023-01-01T01:00:00Z") with data.system.abbey.target.grant.approved_at as "2023-01-01T01:00:00Z" with time.now_ns as 1672538400000000000 } test_before_expired_at_threshold if { - expire_at("2023-01-01T01:00:00Z") with data.system.abbey.target.grant.approved_at as "2023-01-01T01:00:00Z" + functions.expire_at("2023-01-01T01:00:00Z") with data.system.abbey.target.grant.approved_at as "2023-01-01T01:00:00Z" with time.now_ns as 0 } diff --git a/src/abbey/functions/member_of_test.rego b/src/abbey/functions/member_of_test.rego index 399b1d4..f816807 100644 --- a/src/abbey/functions/member_of_test.rego +++ b/src/abbey/functions/member_of_test.rego @@ -1,5 +1,6 @@ package abbey.functions_test +import data.abbey.functions import future.keywords.if fixture := { @@ -14,28 +15,28 @@ fixture := { } test_member_of_googleworkspace_engineering_group if { - member_of("Engineering") with data.user as fixture + functions.member_of("Engineering") with data.user as fixture } test_member_of_okta_group if { - member_of("123") with data.user as fixture + functions.member_of("123") with data.user as fixture } # Tests if the user is a member of a group within Google. However, technically, the way we implement # the `member_of` function entails a lookup against all of the user's `apps`. This means this test # will also produce `false` if the group doesn't exist as a result of the group not being imported. test_not_member_of_googleworkspace_engineering_group if { - not member_of("Marketing") with data.user as fixture + not functions.member_of("Marketing") with data.user as fixture } # Tests if the user is a member of a group within Okta. However, technically, the way we implement # the `member_of` function entails a lookup against all of the user's `apps`. This means this test # will also produce `false` if the group doesn't exist as a result of the group not being imported. test_not_member_of_okta_group if { - not member_of("789") with data.user as fixture + not functions.member_of("789") with data.user as fixture } # Tests if the user is a member of a group, but the group is not imported. test_unimported_group if { - not member_of("unimported") with data.user as fixture + not functions.member_of("unimported") with data.user as fixture }