(t *testing.T)
| 14 | ) |
| 15 | |
| 16 | func TestBasicAuth(t *testing.T) { |
| 17 | pairs := processAccounts(Accounts{ |
| 18 | "admin": "password", |
| 19 | "foo": "bar", |
| 20 | "bar": "foo", |
| 21 | }) |
| 22 | |
| 23 | assert.Len(t, pairs, 3) |
| 24 | assert.Contains(t, pairs, authPair{ |
| 25 | user: "bar", |
| 26 | value: "Basic YmFyOmZvbw==", |
| 27 | }) |
| 28 | assert.Contains(t, pairs, authPair{ |
| 29 | user: "foo", |
| 30 | value: "Basic Zm9vOmJhcg==", |
| 31 | }) |
| 32 | assert.Contains(t, pairs, authPair{ |
| 33 | user: "admin", |
| 34 | value: "Basic YWRtaW46cGFzc3dvcmQ=", |
| 35 | }) |
| 36 | } |
| 37 | |
| 38 | func TestBasicAuthFails(t *testing.T) { |
| 39 | assert.Panics(t, func() { processAccounts(nil) }) |
nothing calls this directly
no test coverage detected