forked from AliyunContainerService/pouch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_image_list_test.go
61 lines (48 loc) · 1.5 KB
/
api_image_list_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package main
import (
"net/url"
"github.com/alibaba/pouch/test/environment"
"github.com/alibaba/pouch/test/request"
"github.com/go-check/check"
)
// APIImageListSuite is the test suite for image list API.
type APIImageListSuite struct{}
func init() {
check.Suite(&APIImageListSuite{})
}
// SetUpTest does common setup in the beginning of each test.
func (suite *APIImageListSuite) SetUpTest(c *check.C) {
SkipIfFalse(c, environment.IsLinux)
}
// TestImageListOk tests listing images is OK.
func (suite *APIImageListSuite) TestImageListOk(c *check.C) {
resp, err := request.Get("/images/json")
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 200)
}
// TestImageListAll tests listing all images layers.
func (suite *APIImageListSuite) TestImageListAll(c *check.C) {
q := url.Values{}
q.Add("all", "true")
query := request.WithQuery(q)
resp, err := request.Get("/images/json", query)
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 200)
// TODO: missing case
//
// check the fields
}
// TestImageListDigest tests listing images digest.
func (suite *APIImageListSuite) TestImageListDigest(c *check.C) {
q := url.Values{}
q.Add("digests", "true")
query := request.WithQuery(q)
resp, err := request.Get("/images/json", query)
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 200)
}
// TestImageListFilter tests listing images with filter.
func (suite *APIImageListSuite) TestImageListFilter(c *check.C) {
// TODO: missing case
helpwantedForMissingCase(c, "iamge api list filter cases")
}