Update service and secret command tests to new golden

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin
2017-08-16 12:53:41 -04:00
parent 0e2bf7420a
commit 4c62d7288f
11 changed files with 67 additions and 110 deletions

View File

@ -3,14 +3,12 @@ package service
import (
"testing"
"golang.org/x/net/context"
"github.com/docker/cli/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/pkg/testutil"
"github.com/docker/docker/pkg/testutil/golden"
"github.com/gotestyourself/gotestyourself/golden"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
)
func TestServiceListOrder(t *testing.T) {
@ -26,7 +24,5 @@ func TestServiceListOrder(t *testing.T) {
cmd := newListCommand(cli)
cmd.Flags().Set("format", "{{.Name}}")
assert.NoError(t, cmd.Execute())
actual := cli.OutBuffer().String()
expected := golden.Get(t, []byte(actual), "service-list-sort.golden")
testutil.EqualNormalizedString(t, testutil.RemoveSpace, actual, string(expected))
golden.Assert(t, cli.OutBuffer().String(), "service-list-sort.golden")
}

View File

@ -3,8 +3,6 @@ package service
import (
"testing"
"bytes"
"github.com/docker/cli/cli/internal/test"
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types"
@ -82,8 +80,7 @@ func TestRunPSWarnsOnNotFound(t *testing.T) {
},
}
out := new(bytes.Buffer)
cli := test.NewFakeCliWithOutput(client, out)
cli := test.NewFakeCli(client)
options := psOptions{
services: []string{"foo", "bar"},
filter: opts.NewFilterOpt(),