Move prefixes for many packages into the globals package (#3069)

This is a prerequisite for some enhancements to grant validation
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2023-03-10 15:06:39 -05:00
1 parent 6adc0c86b5
commit b76b24a4ad
115 files changed
+796 -729

No files matched your search

@@ -12,7 +12,6 @@ import (
"github.com/hashicorp/boundary/internal/auth/oidc"
"github.com/hashicorp/boundary/internal/auth/password"
pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services"
"github.com/hashicorp/boundary/internal/intglobals"
pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/managedgroups"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -41,7 +40,7 @@ func TestValidateCreateRequest(t *testing.T) {
name: "mismatched oidc authmethod pw type",
item: &pb.ManagedGroup{
Type: "ldap",
AuthMethodId: oidc.AuthMethodPrefix + "_1234567890",
AuthMethodId: globals.OidcAuthMethodPrefix + "_1234567890",
},
errContains: fieldError(globals.TypeField, "Doesn't match the parent resource's type."),
},
@@ -49,7 +48,7 @@ func TestValidateCreateRequest(t *testing.T) {
name: "missing oidc attributes",
item: &pb.ManagedGroup{
Type: oidc.Subtype.String(),
AuthMethodId: oidc.AuthMethodPrefix + "_1234567890",
AuthMethodId: globals.OidcAuthMethodPrefix + "_1234567890",
Attrs: nil,
},
errContains: fieldError(globals.AttributesField, "Attribute fields is required."),
@@ -58,7 +57,7 @@ func TestValidateCreateRequest(t *testing.T) {
name: "bad oidc attributes",
item: &pb.ManagedGroup{
Type: oidc.Subtype.String(),
AuthMethodId: oidc.AuthMethodPrefix + "_1234567890",
AuthMethodId: globals.OidcAuthMethodPrefix + "_1234567890",
Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{
OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{
Filter: "foobar",
@@ -71,7 +70,7 @@ func TestValidateCreateRequest(t *testing.T) {
name: "no oidc errors",
item: &pb.ManagedGroup{
Type: oidc.Subtype.String(),
AuthMethodId: oidc.AuthMethodPrefix + "_1234567890",
AuthMethodId: globals.OidcAuthMethodPrefix + "_1234567890",
Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{
OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{
Filter: `"/foo/bar" == "zipzap"`,
@@ -106,7 +105,7 @@ func TestValidateUpdateRequest(t *testing.T) {
{
name: "oidc to password change type",
req: &pbs.UpdateManagedGroupRequest{
Id: intglobals.OidcManagedGroupPrefix + "_1234567890",
Id: globals.OidcManagedGroupPrefix + "_1234567890",
Item: &pb.ManagedGroup{
Type: password.Subtype.String(),
},
@@ -116,7 +115,7 @@ func TestValidateUpdateRequest(t *testing.T) {
{
name: "no error",
req: &pbs.UpdateManagedGroupRequest{
Id: intglobals.OidcManagedGroupPrefix + "_1234567890",
Id: globals.OidcManagedGroupPrefix + "_1234567890",
UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{}},
Item: &pb.ManagedGroup{
Version: 1,