| 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..125e4d5ad6310ffb0ad58b0331f3420240d5e824 100644
|
| --- a/go/src/infra/tools/cipd/remote_test.go
|
| +++ b/go/src/infra/tools/cipd/remote_test.go
|
| @@ -93,6 +93,21 @@ func TestRemoteImpl(t *testing.T) {
|
| return remote.modifyACL("pkgname", changes)
|
| }
|
|
|
| + mockListPackages := func(c C, reply string) ([]string, []string, error) {
|
| + remote := mockRemoteImpl(c, []expectedHTTPCall{
|
| + {
|
| + Method: "GET",
|
| + Path: "/_ah/api/repo/v1/package/search",
|
| + Query: url.Values{
|
| + "path": []string{"pkgpath"},
|
| + "recursive": []string{"false"},
|
| + },
|
| + Reply: reply,
|
| + },
|
| + })
|
| + return remote.listPackages("pkgpath", false)
|
| + }
|
| +
|
| mockAttachTags := func(c C, tags []string, body, reply string) error {
|
| remote := mockRemoteImpl(c, []expectedHTTPCall{
|
| {
|
| @@ -477,6 +492,33 @@ func TestRemoteImpl(t *testing.T) {
|
| So(err, ShouldNotBeNil)
|
| })
|
|
|
| + Convey("listPackages SUCCESS", t, func(c C) {
|
| + pkgs, dirs, err := mockListPackages(c, `{
|
| + "status": "SUCCESS",
|
| + "packages": [
|
| + "pkgpath/fake1",
|
| + "pkgpath/fake2"
|
| + ],
|
| + "directories": []
|
| + }`)
|
| + So(err, ShouldBeNil)
|
| + So(pkgs, ShouldResemble, []string{
|
| + "pkgpath/fake1",
|
| + "pkgpath/fake2",
|
| + })
|
| + So(dirs, ShouldResemble, []string{})
|
| + })
|
| +
|
| + Convey("listPackages ERROR", t, func(c C) {
|
| + pkgs, dirs, err := mockListPackages(c, `{
|
| + "status": "ERROR",
|
| + "error_message": "Some error message"
|
| + }`)
|
| + So(err, ShouldNotBeNil)
|
| + So(pkgs, ShouldBeNil)
|
| + So(dirs, ShouldBeNil)
|
| + })
|
| +
|
| Convey("attachTags SUCCESS", t, func(c C) {
|
| err := mockAttachTags(
|
| c, []string{"tag1:value1", "tag2:value2"},
|
|
|