Code cleaning.
This commit is contained in:
parent
c360395afc
commit
759c269dee
19 changed files with 64 additions and 56 deletions
|
@ -66,14 +66,14 @@ func TestAuthUsersFromFile(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestBasicAuthFail(t *testing.T) {
|
||||
authMiddleware, err := NewAuthenticator(&types.Auth{
|
||||
_, err := NewAuthenticator(&types.Auth{
|
||||
Basic: &types.Basic{
|
||||
Users: []string{"test"},
|
||||
},
|
||||
})
|
||||
assert.Contains(t, err.Error(), "Error parsing Authenticator user", "should contains")
|
||||
|
||||
authMiddleware, err = NewAuthenticator(&types.Auth{
|
||||
authMiddleware, err := NewAuthenticator(&types.Auth{
|
||||
Basic: &types.Basic{
|
||||
Users: []string{"test:test"},
|
||||
},
|
||||
|
@ -125,14 +125,14 @@ func TestBasicAuthSuccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDigestAuthFail(t *testing.T) {
|
||||
authMiddleware, err := NewAuthenticator(&types.Auth{
|
||||
_, err := NewAuthenticator(&types.Auth{
|
||||
Digest: &types.Digest{
|
||||
Users: []string{"test"},
|
||||
},
|
||||
})
|
||||
assert.Contains(t, err.Error(), "Error parsing Authenticator user", "should contains")
|
||||
|
||||
authMiddleware, err = NewAuthenticator(&types.Auth{
|
||||
authMiddleware, err := NewAuthenticator(&types.Auth{
|
||||
Digest: &types.Digest{
|
||||
Users: []string{"test:traefik:test"},
|
||||
},
|
||||
|
@ -161,12 +161,12 @@ func TestBasicAuthUserHeader(t *testing.T) {
|
|||
Basic: &types.Basic{
|
||||
Users: []string{"test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"},
|
||||
},
|
||||
HeaderField: "X-WebAuth-User",
|
||||
HeaderField: "X-Webauth-User",
|
||||
})
|
||||
assert.NoError(t, err, "there should be no error")
|
||||
|
||||
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
assert.Equal(t, "test", r.Header["X-WebAuth-User"][0], "auth user should be set")
|
||||
assert.Equal(t, "test", r.Header["X-Webauth-User"][0], "auth user should be set")
|
||||
fmt.Fprintln(w, "traefik")
|
||||
})
|
||||
n := negroni.New(authMiddleware)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue