authorize: fix policy numbers in evaluator test (#4387)

In authorize_test.go, the policy 'to' URLs are numbered from 1 to 11.
However, there is no number 8 (it looks like it was removed in commit
c178819). Update the URLs with numbers 9 through 11 to remove this gap.
Update the "any authenticated user" test case to use the corresponding
AllowAnyAuthenticatedUser policy (currently this case passes because
it's using the policy that allows any GET request, but it's not testing
what it says it should).
This commit is contained in:
Kenneth Jenkins 2023-07-24 12:02:14 -07:00 committed by GitHub
parent 8d09567fd7
commit 577319d26c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,11 +76,11 @@ func TestEvaluator(t *testing.T) {
AllowedDomains: []string{"example.com"},
},
{
To: config.WeightedURLs{{URL: *mustParseURL("https://to9.example.com")}},
To: config.WeightedURLs{{URL: *mustParseURL("https://to8.example.com")}},
AllowAnyAuthenticatedUser: true,
},
{
To: config.WeightedURLs{{URL: *mustParseURL("https://to10.example.com")}},
To: config.WeightedURLs{{URL: *mustParseURL("https://to9.example.com")}},
Policy: &config.PPLPolicy{
Policy: &parser.Policy{
Rules: []parser.Rule{{
@ -95,7 +95,7 @@ func TestEvaluator(t *testing.T) {
},
},
{
To: config.WeightedURLs{{URL: *mustParseURL("https://to11.example.com")}},
To: config.WeightedURLs{{URL: *mustParseURL("https://to10.example.com")}},
Policy: &config.PPLPolicy{
Policy: &parser.Policy{
Rules: []parser.Rule{{
@ -385,7 +385,7 @@ func TestEvaluator(t *testing.T) {
Id: "user1",
},
}, &Request{
Policy: &policies[8],
Policy: &policies[7],
Session: RequestSession{
ID: "session1",
},