Add Registry to client bindings for Repositories

The way Repositories() was initially called was somewhat different than
other parts of the client bindings because there was no way to instantiate a
Namespace.  This change implements a NewRegistry() function which changes
it so that Repositories() can be called the way one would expect.

It doesn't implement any of the other functions of Namespaces.

Signed-off-by: Patrick Devine <patrick.devine@docker.com>
This commit is contained in:
Patrick Devine 2015-07-22 15:18:03 -07:00
parent bf62b7ebb7
commit a49594a0e1
2 changed files with 90 additions and 60 deletions

View file

@ -768,8 +768,13 @@ func TestCatalog(t *testing.T) {
entries := make([]string, 5)
r, err := NewRegistry(context.Background(), e, nil)
if err != nil {
t.Fatal(err)
}
ctx := context.Background()
numFilled, err := Repositories(ctx, e, entries, "", nil)
numFilled, err := r.Repositories(ctx, entries, "")
if err != io.EOF {
t.Fatal(err)
}
@ -795,8 +800,13 @@ func TestCatalogInParts(t *testing.T) {
entries := make([]string, 2)
r, err := NewRegistry(context.Background(), e, nil)
if err != nil {
t.Fatal(err)
}
ctx := context.Background()
numFilled, err := Repositories(ctx, e, entries, "", nil)
numFilled, err := r.Repositories(ctx, entries, "")
if err != nil {
t.Fatal(err)
}
@ -805,7 +815,7 @@ func TestCatalogInParts(t *testing.T) {
t.Fatalf("Got wrong number of repos")
}
numFilled, err = Repositories(ctx, e, entries, "baz", nil)
numFilled, err = r.Repositories(ctx, entries, "baz")
if err != io.EOF {
t.Fatal(err)
}