| Index: go/src/infra/tools/cipd/remote_test.go
|
| diff --git a/go/src/infra/tools/cipd/remote_test.go b/go/src/infra/tools/cipd/remote_test.go
|
| index e5b4bb43c375ea132b4a8ccbd8071cae1a1b5538..ab1fbd3dece9398919992bc7e4c1e124fbda470e 100644
|
| --- a/go/src/infra/tools/cipd/remote_test.go
|
| +++ b/go/src/infra/tools/cipd/remote_test.go
|
| @@ -93,6 +93,18 @@ func TestRemoteImpl(t *testing.T) {
|
| return remote.modifyACL("pkgname", changes)
|
| }
|
|
|
| + mockListPackages := func(c C, reply string) ([]string, error) {
|
| + remote := mockRemoteImpl(c, []expectedHTTPCall{
|
| + {
|
| + Method: "GET",
|
| + Path: "/_ah/api/repo/v1/packages",
|
| + Query: url.Values{"prefix": []string{"pkgprefix"}},
|
| + Reply: reply,
|
| + },
|
| + })
|
| + return remote.listPackages("pkgprefix")
|
| + }
|
| +
|
| mockAttachTags := func(c C, tags []string, body, reply string) error {
|
| remote := mockRemoteImpl(c, []expectedHTTPCall{
|
| {
|
| @@ -477,6 +489,30 @@ func TestRemoteImpl(t *testing.T) {
|
| So(err, ShouldNotBeNil)
|
| })
|
|
|
| + Convey("listPackages SUCCESS", t, func(c C) {
|
| + result, err := mockListPackages(c, `{
|
| + "status": "SUCCESS",
|
| + "packages": [
|
| + "pkgprefix/fake1",
|
| + "pkgprefix/fake2"
|
| + ]
|
| + }`)
|
| + So(err, ShouldBeNil)
|
| + So(result, ShouldResemble, []string{
|
| + "pkgprefix/fake1",
|
| + "pkgprefix/fake2",
|
| + })
|
| + })
|
| +
|
| + Convey("listPackages ERROR", t, func(c C) {
|
| + result, err := mockListPackages(c, `{
|
| + "status": "ERROR",
|
| + "error_message": "Some error message"
|
| + }`)
|
| + So(err, ShouldNotBeNil)
|
| + So(result, ShouldBeNil)
|
| + })
|
| +
|
| Convey("attachTags SUCCESS", t, func(c C) {
|
| err := mockAttachTags(
|
| c, []string{"tag1:value1", "tag2:value2"},
|
|
|