fix(helm): remove duplication in tests of repo-add command

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
pull/3699/head
Arash Deshmeh 7 years ago
parent a53f93c8ee
commit b66c10df10

@ -17,10 +17,13 @@ limitations under the License.
package main package main
import ( import (
"bytes" "io"
"os" "os"
"testing" "testing"
"github.com/spf13/cobra"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/repo" "k8s.io/helm/pkg/repo"
"k8s.io/helm/pkg/repo/repotest" "k8s.io/helm/pkg/repo/repotest"
) )
@ -49,17 +52,13 @@ func TestRepoAddCmd(t *testing.T) {
{ {
name: "add a repository", name: "add a repository",
args: []string{testName, srv.URL()}, 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 { runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command {
buf := bytes.NewBuffer(nil) return newRepoAddCmd(out)
c := newRepoAddCmd(buf) })
if err := c.RunE(c, tt.args); err != nil {
t.Errorf("%q: expected %q, got %q", tt.name, tt.expected, err)
}
}
} }
func TestRepoAdd(t *testing.T) { func TestRepoAdd(t *testing.T) {

Loading…
Cancel
Save