github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/internal/testing/util_test.go (about) 1 package testing 2 3 import ( 4 "testing" 5 6 "github.com/opentelekomcloud/gophertelekomcloud/internal" 7 th "github.com/opentelekomcloud/gophertelekomcloud/testhelper" 8 ) 9 10 func TestRemainingKeys(t *testing.T) { 11 type User struct { 12 UserID string `json:"user_id"` 13 Username string `json:"username"` 14 Location string `json:"-"` 15 CreatedAt string `json:"-"` 16 Status string 17 IsAdmin bool 18 } 19 20 userResponse := map[string]interface{}{ 21 "user_id": "abcd1234", 22 "username": "jdoe", 23 "location": "Hawaii", 24 "created_at": "2017-06-08T02:49:03.000000", 25 "status": "active", 26 "is_admin": "true", 27 "custom_field": "foo", 28 } 29 30 expected := map[string]interface{}{ 31 "created_at": "2017-06-08T02:49:03.000000", 32 "is_admin": "true", 33 "custom_field": "foo", 34 } 35 36 actual := internal.RemainingKeys(User{}, userResponse) 37 38 th.AssertDeepEquals(t, expected, actual) 39 }