1
0
mirror of https://github.com/moby/moby.git synced 2025-08-08 13:22:22 +03:00

Added tags list to /images/:id/json api.

It closes #10139.

Signed-off-by: Rozhnov Alexandr <nox73@ya.ru>
This commit is contained in:
Rozhnov Alexandr
2015-05-13 16:23:36 +03:00
parent 072790bb3b
commit e9e68fa2d2
5 changed files with 124 additions and 29 deletions

View File

@@ -6,6 +6,8 @@ import (
"net/http"
"strings"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/stringutils"
"github.com/go-check/check"
)
@@ -111,3 +113,23 @@ func (s *DockerSuite) TestInspectApiContainerVolumeDriver(c *check.C) {
c.Fatal("Api version 1.21 expected to include VolumeDriver in 'HostConfig'")
}
}
func (s *DockerSuite) TestInspectApiImageResponse(c *check.C) {
dockerCmd(c, "tag", "busybox:latest", "busybox:mytag")
endpoint := "/images/busybox/json"
status, body, err := sockRequest("GET", endpoint, nil)
c.Assert(err, check.IsNil)
c.Assert(status, check.Equals, http.StatusOK)
var imageJSON types.ImageInspect
if err = json.Unmarshal(body, &imageJSON); err != nil {
c.Fatalf("unable to unmarshal body for latest version: %v", err)
}
c.Assert(len(imageJSON.Tags), check.Equals, 2)
c.Assert(stringutils.InSlice(imageJSON.Tags, "busybox:latest"), check.Equals, true)
c.Assert(stringutils.InSlice(imageJSON.Tags, "busybox:mytag"), check.Equals, true)
}