diff --git a/pkg/cmd/gist/edit/edit_test.go b/pkg/cmd/gist/edit/edit_test.go index a40695c39..5a3f0a268 100644 --- a/pkg/cmd/gist/edit/edit_test.go +++ b/pkg/cmd/gist/edit/edit_test.go @@ -149,7 +149,7 @@ func Test_editRun(t *testing.T) { mockGistList bool httpStubs func(*httpmock.Registry) prompterStubs func(*prompter.MockPrompter) - istty bool + isTTY bool stdin string wantErr string wantLastRequestParameters map[string]interface{} @@ -163,7 +163,7 @@ func Test_editRun(t *testing.T) { }, { name: "one file", - istty: false, + isTTY: false, opts: &EditOptions{ Selector: "1234", }, @@ -194,7 +194,7 @@ func Test_editRun(t *testing.T) { }, { name: "multiple files, submit, with TTY", - istty: true, + isTTY: true, mockGistList: true, prompterStubs: func(pm *prompter.MockPrompter) { pm.RegisterSelect("Edit which file?", @@ -243,7 +243,7 @@ func Test_editRun(t *testing.T) { }, { name: "multiple files, cancel", - istty: true, + isTTY: true, opts: &EditOptions{ Selector: "1234", }, @@ -551,7 +551,7 @@ func Test_editRun(t *testing.T) { }, { name: "no arguments notty", - istty: false, + isTTY: false, opts: &EditOptions{ Selector: "", }, @@ -626,9 +626,9 @@ func Test_editRun(t *testing.T) { } ios, stdin, stdout, stderr := iostreams.Test() stdin.WriteString(tt.stdin) - ios.SetStdoutTTY(tt.istty) - ios.SetStdinTTY(tt.istty) - ios.SetStderrTTY(tt.istty) + ios.SetStdoutTTY(tt.isTTY) + ios.SetStdinTTY(tt.isTTY) + ios.SetStderrTTY(tt.isTTY) tt.opts.IO = ios diff --git a/pkg/cmd/gist/view/view_test.go b/pkg/cmd/gist/view/view_test.go index 820401f1e..706b85f10 100644 --- a/pkg/cmd/gist/view/view_test.go +++ b/pkg/cmd/gist/view/view_test.go @@ -116,10 +116,10 @@ func Test_viewRun(t *testing.T) { name string opts *ViewOptions wantOut string - gist *shared.Gist + mockGist *shared.Gist + mockGistList bool isTTY bool wantErr string - mockGistList bool }{ { name: "no such gist", @@ -137,7 +137,7 @@ func Test_viewRun(t *testing.T) { Selector: "1234", ListFiles: false, }, - gist: &shared.Gist{ + mockGist: &shared.Gist{ Files: map[string]*shared.GistFile{ "cicada.txt": { Content: "bwhiizzzbwhuiiizzzz", @@ -155,7 +155,7 @@ func Test_viewRun(t *testing.T) { ListFiles: false, }, mockGistList: true, - gist: &shared.Gist{ + mockGist: &shared.Gist{ Files: map[string]*shared.GistFile{ "cicada.txt": { Content: "test interactive mode", @@ -178,7 +178,7 @@ func Test_viewRun(t *testing.T) { Filename: "cicada.txt", ListFiles: false, }, - gist: &shared.Gist{ + mockGist: &shared.Gist{ Files: map[string]*shared.GistFile{ "cicada.txt": { Content: "bwhiizzzbwhuiiizzzz", @@ -201,7 +201,7 @@ func Test_viewRun(t *testing.T) { Raw: true, ListFiles: false, }, - gist: &shared.Gist{ + mockGist: &shared.Gist{ Files: map[string]*shared.GistFile{ "cicada.txt": { Content: "bwhiizzzbwhuiiizzzz", @@ -222,7 +222,7 @@ func Test_viewRun(t *testing.T) { Selector: "1234", ListFiles: false, }, - gist: &shared.Gist{ + mockGist: &shared.Gist{ Files: map[string]*shared.GistFile{ "cicada.txt": { Content: "bwhiizzzbwhuiiizzzz", @@ -243,7 +243,7 @@ func Test_viewRun(t *testing.T) { Selector: "1234", ListFiles: false, }, - gist: &shared.Gist{ + mockGist: &shared.Gist{ Files: map[string]*shared.GistFile{ "cicada.txt": { Content: "bwhiizzzbwhuiiizzzz\n", @@ -264,7 +264,7 @@ func Test_viewRun(t *testing.T) { Selector: "1234", ListFiles: false, }, - gist: &shared.Gist{ + mockGist: &shared.Gist{ Description: "some files", Files: map[string]*shared.GistFile{ "cicada.txt": { @@ -287,7 +287,7 @@ func Test_viewRun(t *testing.T) { Raw: true, ListFiles: false, }, - gist: &shared.Gist{ + mockGist: &shared.Gist{ Description: "some files", Files: map[string]*shared.GistFile{ "cicada.txt": { @@ -310,7 +310,7 @@ func Test_viewRun(t *testing.T) { Raw: false, ListFiles: true, }, - gist: &shared.Gist{ + mockGist: &shared.Gist{ Description: "some files", Files: map[string]*shared.GistFile{ "cicada.txt": { @@ -329,7 +329,7 @@ func Test_viewRun(t *testing.T) { Raw: false, ListFiles: true, }, - gist: &shared.Gist{ + mockGist: &shared.Gist{ Description: "some files", Files: map[string]*shared.GistFile{ "cicada.txt": { @@ -348,12 +348,12 @@ func Test_viewRun(t *testing.T) { for _, tt := range tests { reg := &httpmock.Registry{} - if tt.gist == nil { + if tt.mockGist == nil { reg.Register(httpmock.REST("GET", "gists/1234"), httpmock.StatusStringResponse(404, "Not Found")) } else { reg.Register(httpmock.REST("GET", "gists/1234"), - httpmock.JSONResponse(tt.gist)) + httpmock.JSONResponse(tt.mockGist)) } if tt.opts == nil {