# Functions
CompareRequests compare TestScenario to an actual HTTP request.
NewTester creates a new Tester
categories := map[string]tester.TestCategory{
"users": tester.TestCategory{
Scenarios: map[string]tester.TestScenario{
"create": TestScenario{
Request: TestRequest{
Method: "POST",
Path: "/user",
Headers: map[string]string{"Content-Type": "application/json"},
Body: strings.NewReader("{\"username\":\"user1\"}"),
},
Response: TestResponse{
Code: 200,
Headers: map[string]string{"Content-Type": "application/json"},
Body: strings.NewReader("{\"id\":1,\"username\":\"user1\"}"),
},
},
},
}
}
api := tester.NewTester(categories)
*/.
WriteResponse writes TestResponse to an actual HTTP ResponseWriter.
# Structs
TestCategory contains the scenarios for particular category.
Tester provides methods to test a HTTP API client.
TestRequest contains expected request from the API client being tested.
TestResponse contains mock response from the API.
TestScenario contains expected request and mock response.