Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Unified Diff: go/src/infra/tools/cipd/client_test.go

Issue 1194803002: Add a package listing API to cipd. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « go/src/infra/tools/cipd/client.go ('k') | go/src/infra/tools/cipd/remote.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/src/infra/tools/cipd/client_test.go
diff --git a/go/src/infra/tools/cipd/client_test.go b/go/src/infra/tools/cipd/client_test.go
index 80cbb87aaf36f3e9ce61443384899d82c1a14abd..cc20d667f8079548805bb369d0da3902b31a6d39 100644
--- a/go/src/infra/tools/cipd/client_test.go
+++ b/go/src/infra/tools/cipd/client_test.go
@@ -423,6 +423,29 @@ func TestProcessEnsureFile(t *testing.T) {
})
}
+func TestListPackages(t *testing.T) {
+ call := func(c C, dirPath string, recursive bool, calls []expectedHTTPCall) ([]string, error) {
+ client := mockClient(c, "", calls)
+ return client.ListPackages(dirPath, recursive)
+ }
+
+ Convey("ListPackages merges directories", t, func(c C) {
+ out, err := call(c, "", true, []expectedHTTPCall{
+ {
+ Method: "GET",
+ Path: "/_ah/api/repo/v1/package/search",
+ Query: url.Values{
+ "path": []string{""},
+ "recursive": []string{"true"},
+ },
+ Reply: `{"status":"SUCCESS","packages":["dir/pkg"],"directories":["dir"]}`,
+ },
+ })
+ So(err, ShouldBeNil)
+ So(out, ShouldResemble, []string{"dir/", "dir/pkg"})
+ })
+}
+
func TestEnsurePackages(t *testing.T) {
Convey("Mocking temp dir", t, func() {
tempDir, err := ioutil.TempDir("", "cipd_test")
« no previous file with comments | « go/src/infra/tools/cipd/client.go ('k') | go/src/infra/tools/cipd/remote.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698