Skip to content

Commit

Permalink
Update oidc_test.go
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <[email protected]>
  • Loading branch information
mmorel-35 authored Dec 19, 2024
1 parent 182fbb6 commit 5b25e91
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions util/oidc/oidc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ requestedScopes: ["oidc"]`, oidcTestServer.URL),

app.HandleLogin(w, req)

require.Containsf(t, w.Body.String(), "certificate signed by unknown authority", "did not receive expected certificate verification failure error")
require.Containsf(t, w.Body.String(), "certificate is not trusted", "did not receive expected certificate verification failure error")
if assert.NotContainsf(t, w.Body.String(), "certificate signed by unknown authority", "did not receive expected certificate verification failure error") {
require.Containsf(t, w.Body.String(), "certificate is not trusted", "did not receive expected certificate verification failure error")
}

cdSettings.OIDCTLSInsecureSkipVerify = true

Expand Down Expand Up @@ -175,8 +176,9 @@ requestedScopes: ["oidc"]`, oidcTestServer.URL),

app.HandleLogin(w, req)

require.Containsf(t, w.Body.String(), "certificate signed by unknown authority", "did not receive expected certificate verification failure error")
require.Containsf(t, w.Body.String(), "certificate is not trusted", "did not receive expected certificate verification failure error")
if assert.NotContainsf(t, w.Body.String(), "certificate signed by unknown authority", "did not receive expected certificate verification failure error") {
require.Containsf(t, w.Body.String(), "certificate is not trusted", "did not receive expected certificate verification failure error")
}

app, err = NewClientApp(cdSettings, dexTestServer.URL, &dex.DexTLSConfig{StrictValidation: false}, "https://argocd.example.com", cache.NewInMemoryCache(24*time.Hour))
require.NoError(t, err)
Expand Down Expand Up @@ -360,8 +362,9 @@ requestedScopes: ["oidc"]`, oidcTestServer.URL),

app.HandleCallback(w, req)

require.Containsf(t, w.Body.String(), "certificate signed by unknown authority", "did not receive expected certificate verification failure error")
require.Containsf(t, w.Body.String(), "certificate is not trusted", "did not receive expected certificate verification failure error")
if assert.NotContainsf(t, w.Body.String(), "certificate signed by unknown authority", "did not receive expected certificate verification failure error") {
require.Containsf(t, w.Body.String(), "certificate is not trusted", "did not receive expected certificate verification failure error")
}

cdSettings.OIDCTLSInsecureSkipVerify = true

Expand Down Expand Up @@ -399,8 +402,9 @@ requestedScopes: ["oidc"]`, oidcTestServer.URL),

app.HandleCallback(w, req)

require.Containsf(t, w.Body.String(), "certificate signed by unknown authority", "did not receive expected certificate verification failure error")
require.Containsf(t, w.Body.String(), "certificate is not trusted", "did not receive expected certificate verification failure error")
if assert.NotContainsf(t, w.Body.String(), "certificate signed by unknown authority", "did not receive expected certificate verification failure error") {
require.Containsf(t, w.Body.String(), "certificate is not trusted", "did not receive expected certificate verification failure error")
}

app, err = NewClientApp(cdSettings, dexTestServer.URL, &dex.DexTLSConfig{StrictValidation: false}, "https://argocd.example.com", cache.NewInMemoryCache(24*time.Hour))
require.NoError(t, err)
Expand Down

0 comments on commit 5b25e91

Please sign in to comment.