forked from mirror/gin
Fixes auth test
This commit is contained in:
parent
4f855faef2
commit
a91893d22b
30
auth_test.go
30
auth_test.go
|
@ -14,27 +14,25 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBasicAuth(t *testing.T) {
|
func TestBasicAuth(t *testing.T) {
|
||||||
accounts := Accounts{
|
pairs := processAccounts(Accounts{
|
||||||
"admin": "password",
|
"admin": "password",
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
"bar": "foo",
|
"bar": "foo",
|
||||||
}
|
})
|
||||||
expectedPairs := authPairs{
|
|
||||||
authPair{
|
assert.Len(t, pairs, 3)
|
||||||
User: "admin",
|
assert.Contains(t, pairs, authPair{
|
||||||
Value: "Basic YWRtaW46cGFzc3dvcmQ=",
|
|
||||||
},
|
|
||||||
authPair{
|
|
||||||
User: "foo",
|
|
||||||
Value: "Basic Zm9vOmJhcg==",
|
|
||||||
},
|
|
||||||
authPair{
|
|
||||||
User: "bar",
|
User: "bar",
|
||||||
Value: "Basic YmFyOmZvbw==",
|
Value: "Basic YmFyOmZvbw==",
|
||||||
},
|
})
|
||||||
}
|
assert.Contains(t, pairs, authPair{
|
||||||
pairs := processAccounts(accounts)
|
User: "foo",
|
||||||
assert.Equal(t, pairs, expectedPairs)
|
Value: "Basic Zm9vOmJhcg==",
|
||||||
|
})
|
||||||
|
assert.Contains(t, pairs, authPair{
|
||||||
|
User: "admin",
|
||||||
|
Value: "Basic YWRtaW46cGFzc3dvcmQ=",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBasicAuthFails(t *testing.T) {
|
func TestBasicAuthFails(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue