From 1f12c9eb09ed01764f04960ee0a97696ef42cee4 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 3 Oct 2014 15:52:17 -0800 Subject: [PATCH] Fixing up API tests. --- api/helpers_test.go | 4 ++-- api/users_test.go | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/api/helpers_test.go b/api/helpers_test.go index 89800d9..966aedc 100644 --- a/api/helpers_test.go +++ b/api/helpers_test.go @@ -10,11 +10,11 @@ import ( func normalize(v interface{}) { j, err := json.Marshal(v) if err != nil { - panic(fmt.Sprintf("Could not normalize object %+v due to JSON marshalling error: %s", err)) + panic(fmt.Sprintf("Could not normalize object %+v due to JSON marshalling error: %s", v, err)) } err = json.Unmarshal(j, v) if err != nil { - panic(fmt.Sprintf("Could not normalize object %+v due to JSON un-marshalling error: %s", err)) + panic(fmt.Sprintf("Could not normalize object %+v due to JSON un-marshalling error: %s", v, err)) } } diff --git a/api/users_test.go b/api/users_test.go index cba622d..232178c 100644 --- a/api/users_test.go +++ b/api/users_test.go @@ -83,9 +83,8 @@ func TestUser_List(t *testing.T) { if !calledList { t.Error("!calledList") } - for i, _ := range users { - if !normalizeDeepEqual(wantUsers[i], users[i]) { - t.Errorf("got users %+v but wanted users %+v", wantUsers, users) - } + + if !normalizeDeepEqual(&wantUsers, &users) { + t.Errorf("got users %+v but wanted users %+v", users, wantUsers) } }