mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-30 23:09:23 +02:00
authenticateflow: verify redirect in Callback test (#4894)
Add assertions for the redirect URL in the unit test for the stateful authentication flow Callback() method. Remove a commented-out line of debug logging.
This commit is contained in:
parent
fb9eb31be9
commit
915c230d8d
1 changed files with 3 additions and 3 deletions
|
@ -261,7 +261,6 @@ func TestStatefulCallback(t *testing.T) {
|
|||
}
|
||||
|
||||
r := httptest.NewRequest(http.MethodGet, uri.String(), nil)
|
||||
// fmt.Println(uri.String())
|
||||
r.Host = r.URL.Host
|
||||
|
||||
r.Header.Set("Accept", "application/json")
|
||||
|
@ -272,13 +271,14 @@ func TestStatefulCallback(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
location, _ := url.Parse(w.Result().Header.Get("Location"))
|
||||
assert.Equal(t, "example.com", location.Host)
|
||||
assert.Equal(t, "ok", location.Query().Get("pomerium_callback_uri"))
|
||||
} else {
|
||||
if err == nil || !strings.Contains(err.Error(), tt.wantErrorMsg) {
|
||||
t.Errorf("expected error containing %q; got %v", tt.wantErrorMsg, err)
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: assert redirect URL
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue