Fixing up API tests.
This commit is contained in:
parent
0eae5fc6b8
commit
1f12c9eb09
2 changed files with 5 additions and 6 deletions
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue