From b66c10df10a4039adc26ae21edb649b7a2a5f630 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Thu, 15 Mar 2018 21:07:15 -0400 Subject: [PATCH] fix(helm): remove duplication in tests of repo-add command Signed-off-by: Arash Deshmeh --- cmd/helm/repo_add_test.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/cmd/helm/repo_add_test.go b/cmd/helm/repo_add_test.go index 1f49e45ea..79d0d3c53 100644 --- a/cmd/helm/repo_add_test.go +++ b/cmd/helm/repo_add_test.go @@ -17,10 +17,13 @@ limitations under the License. package main import ( - "bytes" + "io" "os" "testing" + "github.com/spf13/cobra" + + "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/repo" "k8s.io/helm/pkg/repo/repotest" ) @@ -49,17 +52,13 @@ func TestRepoAddCmd(t *testing.T) { { name: "add a repository", args: []string{testName, srv.URL()}, - expected: testName + " has been added to your repositories", + expected: "\"" + testName + "\" has been added to your repositories", }, } - for _, tt := range tests { - buf := bytes.NewBuffer(nil) - c := newRepoAddCmd(buf) - if err := c.RunE(c, tt.args); err != nil { - t.Errorf("%q: expected %q, got %q", tt.name, tt.expected, err) - } - } + runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command { + return newRepoAddCmd(out) + }) } func TestRepoAdd(t *testing.T) {