Files
threshold/internal/tests/cluster/parallel/anon_listing_test.go
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.1 KiB
Go
Raw Normal View History

2021-02-04 15:54:40 -05:00
// Copyright (c) HashiCorp, Inc.
2021-02-05 11:00:19 -08:00
// SPDX-License-Identifier: BUSL-1.1
2023-02-02 17:15:17 -08:00
package parallel
2021-02-04 15:54:40 -05:00
import (
"testing"
"github.com/hashicorp/boundary/api/scopes"
"github.com/hashicorp/boundary/internal/cmd/config"
"github.com/hashicorp/boundary/internal/daemon/controller"
2021-02-04 15:54:40 -05:00
"github.com/hashicorp/boundary/internal/types/scope"
"github.com/hashicorp/go-hclog"
"github.com/stretchr/testify/require"
)
func TestAnonListing(t *testing.T) {
t.Parallel()
2021-02-04 15:54:40 -05:00
require := require.New(t)
logger := hclog.New(&hclog.LoggerOptions{
Level: hclog.Trace,
})
conf, err := config.DevController()
require.NoError(err)
c1 := controller.NewTestController(t, &controller.TestControllerOpts{
Config: conf,
InitialResourcesSuffix: "1234567890",
Logger: logger,
})
2021-02-05 11:00:19 -08:00
// Anon user has list and read permissions on scopes by default,
// verify that list scopes returns expected scope without setting token
2021-02-04 15:54:40 -05:00
client := c1.Client()
scps, err := scopes.NewClient(client).List(c1.Context(), scope.Global.String())
require.NoError(err)
require.Len(scps.Items, 1)
}