open-nomad/api/operator_ent_test.go
Tim Gross 1561f66d99
api: fix ENT-only test imports for moved testutil package (#12320)
The `api/testutil` package was moved to `api/internal/testutil` but
this wasn't caught in the ENT tests because they're not run here in
the OSS repo.
2022-03-18 10:12:28 -04:00

30 lines
562 B
Go

//go:build ent
// +build ent
package api
import (
"testing"
"github.com/hashicorp/nomad/api/internal/testutil"
"github.com/stretchr/testify/require"
)
func TestOperator_LicenseGet(t *testing.T) {
testutil.Parallel(t)
c, s, _ := makeACLClient(t, nil, nil)
defer s.Stop()
operator := c.Operator()
// Make authenticated request.
_, _, err := operator.LicenseGet(nil)
require.NoError(t, err)
// Make unauthenticated request.
c.SetSecretID("")
_, _, err = operator.LicenseGet(nil)
require.Error(t, err)
require.Contains(t, err.Error(), "403")
}