mirror of
https://github.com/docker/docs.git
synced 2026-04-12 14:25:46 +07:00
Fixing statusCode checks for sockRequest
Signed-off-by: Megan Kostick <mkostick@us.ibm.com>
This commit is contained in:
@@ -5,6 +5,7 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os/exec"
|
||||
|
||||
"github.com/go-check/check"
|
||||
@@ -18,8 +19,11 @@ func (s *DockerSuite) TestExecApiCreateNoCmd(c *check.C) {
|
||||
c.Fatal(out, err)
|
||||
}
|
||||
|
||||
_, body, err := sockRequest("POST", fmt.Sprintf("/containers/%s/exec", name), map[string]interface{}{"Cmd": nil})
|
||||
if err == nil || !bytes.Contains(body, []byte("No exec command specified")) {
|
||||
c.Fatalf("Expected error when creating exec command with no Cmd specified: %q", err)
|
||||
status, body, err := sockRequest("POST", fmt.Sprintf("/containers/%s/exec", name), map[string]interface{}{"Cmd": nil})
|
||||
c.Assert(status, check.Equals, http.StatusInternalServerError)
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
if !bytes.Contains(body, []byte("No exec command specified")) {
|
||||
c.Fatalf("Expected message when creating exec command with no Cmd specified")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user