From a91893d22b6831cd719df40de0d189976e8c210e Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Tue, 19 May 2015 22:19:25 +0200 Subject: [PATCH] Fixes auth test --- auth_test.go | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/auth_test.go b/auth_test.go index 9fd9cec..b22d9ce 100644 --- a/auth_test.go +++ b/auth_test.go @@ -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) {