Unverified Commit c4c165e8 authored by Matthew Fisher's avatar Matthew Fisher Committed by GitHub

Merge pull request #3699 from adshmh/fix-duplication-of-test-code-on-helm-repo-add

Refactor tests of repo-add command to remove duplication
parents 4711d5b8 b66c10df
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment