Last active
January 30, 2017 14:31
-
-
Save flimzy/b3011e026c1dff179fad70fbc56cfd5c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. | |
Request{ | |
Name: "Tickets for Admin", | |
Method: "GET", | |
URL: Server.URL + "/v1/inboxes/9991/tickets/Active.json", | |
StatusCode: http.StatusOK, | |
TestContentType: "application/json", | |
TestCharset: "utf-8", | |
TestBodyJSON: func(i interface{}) error { | |
m, ok := i.(map[string]interface{}) | |
if !ok { | |
return errors.New("JSON response is not a map[string]interface{}") | |
} | |
for _, prop := range []string{"count", "maxPages", "page", "ticket"} { | |
if _, ok := m[prop]; !ok { | |
return errors.Errorf("JSON response does not contain '%s' property'", prop) | |
} | |
} | |
return nil | |
}, | |
}.Test(t) | |
2. | |
Request(t, "Tickets for Admin"). | |
Method("GET"). | |
URL(Server.URL+"/v1/inboxes/9991/tickets/Active.json"). | |
SetHeader("Accept", "application/json"). | |
Test(). | |
StatusCode(http.StatusOK). | |
ContentType("application/json"). | |
Charset("utf-8"). | |
TestBodyJSON(func(i interface{}) error { | |
m, ok := i.(map[string]interface{}) | |
if !ok { | |
return errors.New("JSON response is not a map[string]interface{}") | |
} | |
for _, prop := range []string{"count", "maxPages", "page", "ticket"} { | |
if _, ok := m[prop]; !ok { | |
return errors.Errorf("JSON response does not contain '%s' property'", prop) | |
} | |
} | |
return nil | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment