Joe Topjian | 1e9551c | 2017-06-03 10:35:33 -0600 | [diff] [blame^] | 1 | package testing |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "gerrit.mcp.mirantis.net/debian/gophercloud.git/internal" |
| 7 | th "gerrit.mcp.mirantis.net/debian/gophercloud.git/testhelper" |
| 8 | ) |
| 9 | |
| 10 | func TestRemainingKeys(t *testing.T) { |
| 11 | type User struct { |
| 12 | FirstName string `json:"first_name"` |
| 13 | LastName string `json:"last_name"` |
| 14 | City string |
| 15 | } |
| 16 | |
| 17 | userStruct := User{ |
| 18 | FirstName: "John", |
| 19 | LastName: "Doe", |
| 20 | } |
| 21 | |
| 22 | userMap := map[string]interface{}{ |
| 23 | "first_name": "John", |
| 24 | "last_name": "Doe", |
| 25 | "city": "Honolulu", |
| 26 | "state": "Hawaii", |
| 27 | } |
| 28 | |
| 29 | expected := map[string]interface{}{ |
| 30 | "city": "Honolulu", |
| 31 | "state": "Hawaii", |
| 32 | } |
| 33 | |
| 34 | actual := internal.RemainingKeys(userStruct, userMap) |
| 35 | th.AssertDeepEquals(t, expected, actual) |
| 36 | } |