Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Spent too many hours to realize the unit test needed to be fixed
🤦
  • Loading branch information
Emyrk committed Sep 23, 2022
commit 7c238d4ba4caeca37abb23066abde7025bd7551c
6 changes: 3 additions & 3 deletions coderd/rbac/authz_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ func testAuthorize(t *testing.T, name string, subject subject, sets ...[]authTes
assert.Error(t, authError, "expected unauthorized")
}

partialAuthz, err := authorizer.Prepare(ctx, subject.UserID, subject.Roles, must(ScopeRole(ScopeAll)), a, c.resource.Type)
partialAuthz, err := authorizer.Prepare(ctx, subject.UserID, subject.Roles, subject.Scope, a, c.resource.Type)
require.NoError(t, err, "make prepared authorizer")

// Also check the rego policy can form a valid partial query result.
Expand All @@ -760,9 +760,9 @@ func testAuthorize(t *testing.T, name string, subject subject, sets ...[]authTes

partialErr := partialAuthz.Authorize(ctx, c.resource)
if authError != nil {
assert.Error(t, partialErr, "partial error blocked valid request (false negative)")
assert.Error(t, partialErr, "partial allowed invalid request (false positive)")
} else {
assert.NoError(t, partialErr, "partial allowed invalid request (false positive)")
assert.NoError(t, partialErr, "partial error blocked valid request (false negative)")
}
}
})
Expand Down