fix(cmd): rename list cmd context

pull/921/head
Adam Reese 8 years ago
parent 4d92bd086f
commit 6453c99241

@ -53,7 +53,7 @@ server's default, which may be much higher than 256. Pairing the '--max'
flag with the '--offset' flag allows you to page through results. flag with the '--offset' flag allows you to page through results.
` `
type lister struct { type listCmd struct {
filter string filter string
long bool long bool
limit int limit int
@ -65,7 +65,7 @@ type lister struct {
} }
func newListCmd(client helm.Interface, out io.Writer) *cobra.Command { func newListCmd(client helm.Interface, out io.Writer) *cobra.Command {
list := &lister{out: out} list := &listCmd{out: out}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "list [flags] [FILTER]", Use: "list [flags] [FILTER]",
Short: "list releases", Short: "list releases",
@ -91,7 +91,7 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command {
return cmd return cmd
} }
func (l *lister) run() error { func (l *listCmd) run() error {
sortBy := services.ListSort_NAME sortBy := services.ListSort_NAME
if l.byDate { if l.byDate {
sortBy = services.ListSort_LAST_RELEASED sortBy = services.ListSort_LAST_RELEASED

@ -51,13 +51,13 @@ func (fl *fakeReleaseLister) ListReleases(opts ...helm.ReleaseListOption) (*rls.
func TestListRun(t *testing.T) { func TestListRun(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
lister *lister listCmd *listCmd
expected string expected string
err bool err bool
}{ }{
{ {
name: "with a release", name: "with a release",
lister: &lister{ listCmd: &listCmd{
client: &fakeReleaseLister{ client: &fakeReleaseLister{
rels: []*release.Release{ rels: []*release.Release{
releaseMock("thomas-guide"), releaseMock("thomas-guide"),
@ -68,7 +68,7 @@ func TestListRun(t *testing.T) {
}, },
{ {
name: "list --long", name: "list --long",
lister: &lister{ listCmd: &listCmd{
client: &fakeReleaseLister{ client: &fakeReleaseLister{
rels: []*release.Release{ rels: []*release.Release{
releaseMock("atlas"), releaseMock("atlas"),
@ -82,8 +82,8 @@ func TestListRun(t *testing.T) {
var buf bytes.Buffer var buf bytes.Buffer
for _, tt := range tests { for _, tt := range tests {
tt.lister.out = &buf tt.listCmd.out = &buf
err := tt.lister.run() err := tt.listCmd.run()
if (err != nil) != tt.err { if (err != nil) != tt.err {
t.Errorf("%q. expected error: %v, got %v", tt.name, tt.err, err) t.Errorf("%q. expected error: %v, got %v", tt.name, tt.err, err)
} }

Loading…
Cancel
Save