11 "golang.org/x/net/context"
14 func TestContainerPauseError(t *testing.T) {
16 client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
18 err := client.ContainerPause(context.Background(), "nothing")
19 if err == nil || err.Error() != "Error response from daemon: Server error" {
20 t.Fatalf("expected a Server Error, got %v", err)
24 func TestContainerPause(t *testing.T) {
25 expectedURL := "/containers/container_id/pause"
27 client: newMockClient(func(req *http.Request) (*http.Response, error) {
28 if !strings.HasPrefix(req.URL.Path, expectedURL) {
29 return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
31 return &http.Response{
32 StatusCode: http.StatusOK,
33 Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
37 err := client.ContainerPause(context.Background(), "container_id")