github.com/hashicorp/nomad/api@v0.0.0-20240306165712-3193ac204f65/operator_ent_test.go (about) 1 // Copyright (c) HashiCorp, Inc. 2 // SPDX-License-Identifier: MPL-2.0 3 4 //go:build ent 5 6 package api 7 8 import ( 9 "testing" 10 11 "github.com/hashicorp/nomad/api/internal/testutil" 12 "github.com/shoenig/test/must" 13 ) 14 15 func TestOperator_LicenseGet(t *testing.T) { 16 testutil.Parallel(t) 17 18 c, s, _ := makeACLClient(t, nil, nil) 19 defer s.Stop() 20 21 operator := c.Operator() 22 23 // Make authenticated request. 24 _, _, err := operator.LicenseGet(nil) 25 must.NoError(t, err) 26 27 // Make unauthenticated request. 28 c.SetSecretID("") 29 _, _, err = operator.LicenseGet(nil) 30 must.ErrorContains(t, err, "403") 31 }