Fix CORS test

This commit is contained in:
Jeff Mitchell committed 2020-08-25 12:45:16 -04:00
1 parent de162c5533
commit 39721047e4
1 file changed
+8 -1
+8 -1
View File
@@ -1,6 +1,7 @@
package controller
import (
"context"
"fmt"
"net/http"
"net/url"
@@ -9,6 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/hashicorp/boundary/internal/authtoken"
"github.com/hashicorp/boundary/internal/cmd/config"
"github.com/hashicorp/boundary/internal/iam"
"github.com/hashicorp/go-retryablehttp"
@@ -80,6 +82,10 @@ func TestHandler_CORS(t *testing.T) {
require.NoError(t, err)
org := iam.TestOrg(t, repo)
encToken, err := authtoken.EncryptToken(context.Background(), tc.c.kms, "fo_o", "bar")
require.NoError(t, err)
token := "fo_o_" + encToken
cases := []struct {
name string
method string
@@ -189,7 +195,8 @@ func TestHandler_CORS(t *testing.T) {
client := tc.Client()
err := client.SetAddr(tc.ApiAddrs()[c.listenerNum-1])
require.NoError(t, err)
client.SetToken("fo_o_bar")
client.SetToken(token)
// Create the request
var req *retryablehttp.Request