mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: add Filters type
Add a new type to use for building filter predicates for API requests, replacing "./api/types/filters".Args in the client. Remove the now unused api/types/filters package. Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
"testing"
|
||||
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"github.com/moby/moby/api/types/filters"
|
||||
"github.com/moby/moby/api/types/plugin"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
@@ -20,7 +19,7 @@ func TestPluginListError(t *testing.T) {
|
||||
client, err := NewClientWithOpts(WithMockClient(errorMock(http.StatusInternalServerError, "Server error")))
|
||||
assert.NilError(t, err)
|
||||
|
||||
_, err = client.PluginList(context.Background(), filters.NewArgs())
|
||||
_, err = client.PluginList(context.Background(), nil)
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
|
||||
}
|
||||
|
||||
@@ -28,11 +27,10 @@ func TestPluginList(t *testing.T) {
|
||||
const expectedURL = "/plugins"
|
||||
|
||||
listCases := []struct {
|
||||
filters filters.Args
|
||||
filters Filters
|
||||
expectedQueryParams map[string]string
|
||||
}{
|
||||
{
|
||||
filters: filters.NewArgs(),
|
||||
expectedQueryParams: map[string]string{
|
||||
"all": "",
|
||||
"filter": "",
|
||||
@@ -40,7 +38,7 @@ func TestPluginList(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
filters: filters.NewArgs(filters.Arg("enabled", "true")),
|
||||
filters: make(Filters).Add("enabled", "true"),
|
||||
expectedQueryParams: map[string]string{
|
||||
"all": "",
|
||||
"filter": "",
|
||||
@@ -48,10 +46,7 @@ func TestPluginList(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
filters: filters.NewArgs(
|
||||
filters.Arg("capability", "volumedriver"),
|
||||
filters.Arg("capability", "authz"),
|
||||
),
|
||||
filters: make(Filters).Add("capability", "volumedriver", "authz"),
|
||||
expectedQueryParams: map[string]string{
|
||||
"all": "",
|
||||
"filter": "",
|
||||
|
||||
Reference in New Issue
Block a user