Update unit tests for username
This commit is contained in:
parent
5a50f6223f
commit
058ffd1047
@ -1179,7 +1179,7 @@ func TestGetJwtSession(t *testing.T) {
|
|||||||
|
|
||||||
// Bearer
|
// Bearer
|
||||||
session, _ := p.GetJwtSession(req)
|
session, _ := p.GetJwtSession(req)
|
||||||
assert.Equal(t, session.User, "john")
|
assert.Equal(t, session.User, "john@example.com")
|
||||||
assert.Equal(t, session.Email, "john@example.com")
|
assert.Equal(t, session.Email, "john@example.com")
|
||||||
assert.Equal(t, session.ExpiresOn, time.Unix(1912151821, 0))
|
assert.Equal(t, session.ExpiresOn, time.Unix(1912151821, 0))
|
||||||
assert.Equal(t, session.IDToken, goodJwt)
|
assert.Equal(t, session.IDToken, goodJwt)
|
||||||
@ -1223,12 +1223,12 @@ func TestGetJwtSession(t *testing.T) {
|
|||||||
|
|
||||||
// Check PassAuthorization, should overwrite Basic header
|
// Check PassAuthorization, should overwrite Basic header
|
||||||
assert.Equal(t, req.Header.Get("Authorization"), authHeader)
|
assert.Equal(t, req.Header.Get("Authorization"), authHeader)
|
||||||
assert.Equal(t, req.Header.Get("X-Forwarded-User"), "john")
|
assert.Equal(t, req.Header.Get("X-Forwarded-User"), "john@example.com")
|
||||||
assert.Equal(t, req.Header.Get("X-Forwarded-Email"), "john@example.com")
|
assert.Equal(t, req.Header.Get("X-Forwarded-Email"), "john@example.com")
|
||||||
|
|
||||||
// SetAuthorization and SetXAuthRequest
|
// SetAuthorization and SetXAuthRequest
|
||||||
assert.Equal(t, rw.Header().Get("Authorization"), authHeader)
|
assert.Equal(t, rw.Header().Get("Authorization"), authHeader)
|
||||||
assert.Equal(t, rw.Header().Get("X-Auth-Request-User"), "john")
|
assert.Equal(t, rw.Header().Get("X-Auth-Request-User"), "john@example.com")
|
||||||
assert.Equal(t, rw.Header().Get("X-Auth-Request-Email"), "john@example.com")
|
assert.Equal(t, rw.Header().Get("X-Auth-Request-Email"), "john@example.com")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user