removed the if/else statements and added c.Assert statements for docker_api_create_test.go.
Removed check.commentf in c.Assert statements
Signed-off-by: Zuhayr Elahi <elahi.zuhayr@gmail.com>
| ... | ... |
@@ -4,6 +4,7 @@ import ( |
| 4 | 4 |
"net/http" |
| 5 | 5 |
"strings" |
| 6 | 6 |
|
| 7 |
+ "github.com/docker/docker/pkg/integration/checker" |
|
| 7 | 8 |
"github.com/go-check/check" |
| 8 | 9 |
) |
| 9 | 10 |
|
| ... | ... |
@@ -18,9 +19,7 @@ func (s *DockerSuite) TestApiCreateWithNotExistImage(c *check.C) {
|
| 18 | 18 |
c.Assert(err, check.IsNil) |
| 19 | 19 |
c.Assert(status, check.Equals, http.StatusNotFound) |
| 20 | 20 |
expected := "No such image: test456:v1" |
| 21 |
- if !strings.Contains(string(resp), expected) {
|
|
| 22 |
- c.Fatalf("expected: %s, got: %s", expected, string(resp))
|
|
| 23 |
- } |
|
| 21 |
+ c.Assert(strings.TrimSpace(string(resp)), checker.Contains, expected) |
|
| 24 | 22 |
|
| 25 | 23 |
config2 := map[string]interface{}{
|
| 26 | 24 |
"Image": "test456", |
| ... | ... |
@@ -31,8 +30,6 @@ func (s *DockerSuite) TestApiCreateWithNotExistImage(c *check.C) {
|
| 31 | 31 |
c.Assert(err, check.IsNil) |
| 32 | 32 |
c.Assert(status, check.Equals, http.StatusNotFound) |
| 33 | 33 |
expected = "No such image: test456:latest" |
| 34 |
- if !strings.Contains(string(resp), expected) {
|
|
| 35 |
- c.Fatalf("expected: %s, got: %s", expected, string(resp))
|
|
| 36 |
- } |
|
| 34 |
+ c.Assert(strings.TrimSpace(string(resp)), checker.Equals, expected) |
|
| 37 | 35 |
|
| 38 | 36 |
} |