23
23
_, err := context.ListContainers(request)
24
24
c.Check(err, ErrorMatches, ".*"+errorMessage+".*")
27
func (suite *testTesting) TestNewDispatcherResponse(c *C) {
28
body := []byte("test body")
29
statusCode := http.StatusOK
30
errorObject := fmt.Errorf("canned-error")
31
dispatcherResponse := NewDispatcherResponse(body, statusCode, errorObject)
32
c.Check(dispatcherResponse.errorObject, Equals, errorObject)
33
c.Check(dispatcherResponse.response.Body, DeepEquals, body)
34
c.Check(dispatcherResponse.response.StatusCode, Equals, statusCode)
37
func (suite *testTesting) TestPatchManagementAPIResponses(c *C) {
38
response := NewDispatcherResponse([]byte("<Images></Images>"), http.StatusOK, nil)
39
responses := []DispatcherResponse{response, response}
40
requests := PatchManagementAPIResponses(responses)
42
_, err := api.ListOSImages()
44
_, err = api.ListOSImages()
46
c.Assert(len(*requests), Equals, 2)
47
c.Check((*requests)[0].URL, Equals, api.session.composeURL("services/images"))
48
c.Check((*requests)[1].URL, Equals, api.session.composeURL("services/images"))