integration: fix wrong jwt assertion test (#909)

The test intends to check "X-Pomerium-Jwt-Assertion" exists in response
header and not empty, but accidently always test for non-empty string.
This commit is contained in:
Cuong Manh Le 2020-06-17 21:49:39 +07:00 committed by GitHub
parent bb6c0ab725
commit 8856577f39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,6 +12,7 @@ import (
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/pomerium/pomerium/integration/internal/flows"
"github.com/pomerium/pomerium/integration/internal/netutil" "github.com/pomerium/pomerium/integration/internal/netutil"
) )
@ -415,13 +416,8 @@ func TestAttestationJWT(t *testing.T) {
defer clearTimeout() defer clearTimeout()
client := testcluster.NewHTTPClient() client := testcluster.NewHTTPClient()
res, err := flows.Authenticate(ctx, client, mustParseURL("https://httpdetails.localhost.pomerium.io/by-user"),
req, err := http.NewRequestWithContext(ctx, "GET", "https://httpdetails.localhost.pomerium.io/", nil) nil, flows.WithEmail("bob@dogs.test"), flows.WithGroups("user"))
if err != nil {
t.Fatal(err)
}
res, err := client.Do(req)
if !assert.NoError(t, err, "unexpected http error") { if !assert.NoError(t, err, "unexpected http error") {
return return
} }
@ -435,9 +431,5 @@ func TestAttestationJWT(t *testing.T) {
return return
} }
assert.NotEmpty(t, assert.NotEmpty(t, result.Headers["X-Pomerium-Jwt-Assertion"], "Expected JWT assertion")
"X-Pomerium-Jwt-Assertion-Value",
result.Headers["X-Pomerium-Jwt-Assertion"],
"Expected JWT assertion")
} }