Fixes auth test

This commit is contained in:
Manu Mtz-Almeida 2015-05-19 22:19:25 +02:00
parent 4f855faef2
commit a91893d22b
1 changed files with 16 additions and 18 deletions

View File

@ -14,27 +14,25 @@ import (
)
func TestBasicAuth(t *testing.T) {
accounts := Accounts{
pairs := processAccounts(Accounts{
"admin": "password",
"foo": "bar",
"bar": "foo",
}
expectedPairs := authPairs{
authPair{
User: "admin",
Value: "Basic YWRtaW46cGFzc3dvcmQ=",
},
authPair{
User: "foo",
Value: "Basic Zm9vOmJhcg==",
},
authPair{
User: "bar",
Value: "Basic YmFyOmZvbw==",
},
}
pairs := processAccounts(accounts)
assert.Equal(t, pairs, expectedPairs)
})
assert.Len(t, pairs, 3)
assert.Contains(t, pairs, authPair{
User: "bar",
Value: "Basic YmFyOmZvbw==",
})
assert.Contains(t, pairs, authPair{
User: "foo",
Value: "Basic Zm9vOmJhcg==",
})
assert.Contains(t, pairs, authPair{
User: "admin",
Value: "Basic YWRtaW46cGFzc3dvcmQ=",
})
}
func TestBasicAuthFails(t *testing.T) {