parent
e1238015f5
commit
d5334f4115
26 changed files with 79 additions and 187 deletions
|
|
@ -106,7 +106,6 @@ func Test_logoutRun_tty(t *testing.T) {
|
|||
cfgHosts: []string{"cheryl.mason", "github.com"},
|
||||
wantHosts: "cheryl.mason:\n oauth_token: abc123\n",
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What account do you want to log out of?").AnswerWith("github.com")
|
||||
},
|
||||
wantErrOut: regexp.MustCompile(`Logged out of github.com account 'cybilb'`),
|
||||
|
|
|
|||
|
|
@ -194,7 +194,6 @@ func Test_refreshRun(t *testing.T) {
|
|||
Hostname: "",
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What account do you want to refresh auth for?").AnswerWith("github.com")
|
||||
},
|
||||
wantAuthArgs: authArgs{
|
||||
|
|
|
|||
|
|
@ -162,9 +162,7 @@ func Test_editRun(t *testing.T) {
|
|||
{
|
||||
name: "multiple files, submit",
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Edit which file?").AnswerWith("unix.md")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What next?").AnswerWith("Submit")
|
||||
},
|
||||
gist: &shared.Gist{
|
||||
|
|
@ -209,9 +207,7 @@ func Test_editRun(t *testing.T) {
|
|||
{
|
||||
name: "multiple files, cancel",
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Edit which file?").AnswerWith("unix.md")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What next?").AnswerWith("Cancel")
|
||||
},
|
||||
wantErr: "CancelError",
|
||||
|
|
|
|||
|
|
@ -356,7 +356,6 @@ func Test_viewRun(t *testing.T) {
|
|||
)
|
||||
|
||||
as := prompt.NewAskStubber(t)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Select a gist").AnswerDefault()
|
||||
}
|
||||
|
||||
|
|
@ -402,7 +401,6 @@ func Test_promptGists(t *testing.T) {
|
|||
{
|
||||
name: "multiple files, select first gist",
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Select a gist").AnswerWith("cool.txt about 6 hours ago")
|
||||
},
|
||||
response: `{ "data": { "viewer": { "gists": { "nodes": [
|
||||
|
|
@ -426,7 +424,6 @@ func Test_promptGists(t *testing.T) {
|
|||
{
|
||||
name: "multiple files, select second gist",
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Select a gist").AnswerWith("gistfile0.txt about 6 hours ago")
|
||||
},
|
||||
response: `{ "data": { "viewer": { "gists": { "nodes": [
|
||||
|
|
|
|||
|
|
@ -404,11 +404,8 @@ func TestIssueCreate_recover(t *testing.T) {
|
|||
|
||||
as := prompt.NewAskStubber(t)
|
||||
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Title").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Body").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What's next?").AnswerWith("Submit")
|
||||
|
||||
tmpfile, err := os.CreateTemp(t.TempDir(), "testrecover*")
|
||||
|
|
@ -474,11 +471,8 @@ func TestIssueCreate_nonLegacyTemplate(t *testing.T) {
|
|||
|
||||
as := prompt.NewAskStubber(t)
|
||||
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Choose a template").AnswerWith("Submit a request")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Body").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What's next?").
|
||||
AssertOptions([]string{"Submit", "Continue in browser", "Cancel"}).
|
||||
AnswerWith("Submit")
|
||||
|
|
@ -507,9 +501,7 @@ func TestIssueCreate_continueInBrowser(t *testing.T) {
|
|||
|
||||
as := prompt.NewAskStubber(t)
|
||||
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Title").AnswerWith("hello")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What's next?").AnswerWith("Continue in browser")
|
||||
|
||||
_, cmdTeardown := run.Stub()
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ func TestIssueDelete(t *testing.T) {
|
|||
)
|
||||
|
||||
as := prompt.NewAskStubber(t)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("You're going to delete issue #13. This action cannot be reversed. To confirm, type the issue number:").AnswerWith("13")
|
||||
|
||||
output, err := runCommand(httpRegistry, true, "13")
|
||||
|
|
@ -138,7 +137,6 @@ func TestIssueDelete_cancel(t *testing.T) {
|
|||
)
|
||||
|
||||
as := prompt.NewAskStubber(t)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("You're going to delete issue #13. This action cannot be reversed. To confirm, type the issue number:").AnswerWith("14")
|
||||
|
||||
output, err := runCommand(httpRegistry, true, "13")
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@ func TestDeleteRun(t *testing.T) {
|
|||
askStubs: func(as *prompt.AskStubber) {
|
||||
// TODO: survey stubber doesn't have WithValidator support
|
||||
// so this always passes regardless of prompt input
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Type test to confirm deletion:").AnswerWith("test")
|
||||
},
|
||||
wantStdout: "✓ Label \"test\" deleted from OWNER/REPO\n",
|
||||
|
|
|
|||
|
|
@ -311,15 +311,12 @@ func TestPRCreate_recover(t *testing.T) {
|
|||
cs.Register(`git status --porcelain`, 0, "")
|
||||
cs.Register(`git( .+)? log( .+)? origin/master\.\.\.feature`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Title").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Body").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What's next?").AnswerDefault()
|
||||
|
||||
tmpfile, err := os.CreateTemp(t.TempDir(), "testrecover*")
|
||||
|
|
@ -412,11 +409,10 @@ func TestPRCreate(t *testing.T) {
|
|||
cs.Register(`git show-ref --verify -- HEAD refs/remotes/origin/feature`, 0, "")
|
||||
cs.Register(`git push --set-upstream origin HEAD:feature`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
ask, cleanupAsk := prompt.InitAskStubber()
|
||||
defer cleanupAsk()
|
||||
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
ask.StubPrompt("Where should we push the 'feature' branch?").AnswerDefault()
|
||||
|
||||
output, err := runCommand(http, nil, "feature", true, `-t "my title" -b "my body"`)
|
||||
|
|
@ -460,11 +456,10 @@ func TestPRCreate_NoMaintainerModify(t *testing.T) {
|
|||
cs.Register(`git show-ref --verify -- HEAD refs/remotes/origin/feature`, 0, "")
|
||||
cs.Register(`git push --set-upstream origin HEAD:feature`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
ask, cleanupAsk := prompt.InitAskStubber()
|
||||
defer cleanupAsk()
|
||||
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
ask.StubPrompt("Where should we push the 'feature' branch?").AnswerDefault()
|
||||
|
||||
output, err := runCommand(http, nil, "feature", true, `-t "my title" -b "my body" --no-maintainer-edit`)
|
||||
|
|
@ -513,11 +508,10 @@ func TestPRCreate_createFork(t *testing.T) {
|
|||
cs.Register(`git remote add -f fork https://github.com/monalisa/REPO.git`, 0, "")
|
||||
cs.Register(`git push --set-upstream fork HEAD:feature`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
ask, cleanupAsk := prompt.InitAskStubber()
|
||||
defer cleanupAsk()
|
||||
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
ask.StubPrompt("Where should we push the 'feature' branch?").
|
||||
AssertOptions([]string{"OWNER/REPO", "Create a fork of OWNER/REPO", "Skip pushing the branch", "Cancel"}).
|
||||
AnswerWith("Create a fork of OWNER/REPO")
|
||||
|
|
@ -574,7 +568,7 @@ func TestPRCreate_pushedToNonBaseRepo(t *testing.T) {
|
|||
deadbeef refs/remotes/origin/feature
|
||||
`)) // determineTrackingBranch
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
_, cleanupAsk := prompt.InitAskStubber()
|
||||
defer cleanupAsk()
|
||||
|
||||
|
|
@ -616,7 +610,7 @@ func TestPRCreate_pushedToDifferentBranchName(t *testing.T) {
|
|||
deadbeef refs/remotes/origin/my-feat2
|
||||
`)) // determineTrackingBranch
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
_, cleanupAsk := prompt.InitAskStubber()
|
||||
defer cleanupAsk()
|
||||
|
||||
|
|
@ -662,13 +656,10 @@ func TestPRCreate_nonLegacyTemplate(t *testing.T) {
|
|||
|
||||
as := prompt.NewAskStubber(t)
|
||||
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Choose a template").
|
||||
AssertOptions([]string{"template1", "template2", "Open a blank pull request"}).
|
||||
AnswerWith("template1")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Body").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What's next?").
|
||||
AssertOptions([]string{"Submit", "Submit as draft", "Continue in browser", "Add metadata", "Cancel"}).
|
||||
AnswerDefault()
|
||||
|
|
@ -810,11 +801,10 @@ func TestPRCreate_web(t *testing.T) {
|
|||
cs.Register(`git( .+)? log( .+)? origin/master\.\.\.feature`, 0, "")
|
||||
cs.Register(`git push --set-upstream origin HEAD:feature`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
ask, cleanupAsk := prompt.InitAskStubber()
|
||||
defer cleanupAsk()
|
||||
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
ask.StubPrompt("Where should we push the 'feature' branch?").
|
||||
AssertOptions([]string{"OWNER/REPO", "Skip pushing the branch", "Cancel"}).
|
||||
AnswerDefault()
|
||||
|
|
@ -886,11 +876,10 @@ func TestPRCreate_webProject(t *testing.T) {
|
|||
cs.Register(`git( .+)? log( .+)? origin/master\.\.\.feature`, 0, "")
|
||||
cs.Register(`git push --set-upstream origin HEAD:feature`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
ask, cleanupAsk := prompt.InitAskStubber()
|
||||
defer cleanupAsk()
|
||||
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
ask.StubPrompt("Where should we push the 'feature' branch?").AnswerDefault()
|
||||
|
||||
output, err := runCommand(http, nil, "feature", true, `--web -p Triage`)
|
||||
|
|
@ -929,11 +918,8 @@ func TestPRCreate_draft(t *testing.T) {
|
|||
|
||||
as := prompt.NewAskStubber(t)
|
||||
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Choose a template").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Body").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What's next?").
|
||||
AssertOptions([]string{"Submit", "Submit as draft", "Continue in browser", "Add metadata", "Cancel"}).
|
||||
AnswerWith("Submit as draft")
|
||||
|
|
|
|||
|
|
@ -961,7 +961,6 @@ func TestPrMerge_alreadyMerged(t *testing.T) {
|
|||
cs.Register(`git pull --ff-only`, 0, "")
|
||||
|
||||
as := prompt.NewAskStubber(t)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Pull request #4 was already merged. Delete the branch locally?").AnswerWith(true)
|
||||
|
||||
output, err := runCommand(http, "blueberries", true, "pr merge 4")
|
||||
|
|
@ -1023,7 +1022,6 @@ func TestPrMerge_alreadyMerged_withMergeStrategy_TTY(t *testing.T) {
|
|||
cs.Register(`git branch -D `, 0, "")
|
||||
|
||||
as := prompt.NewAskStubber(t)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Pull request #4 was already merged. Delete the branch locally?").AnswerWith(true)
|
||||
|
||||
output, err := runCommand(http, "blueberries", true, "pr merge 4 --merge")
|
||||
|
|
@ -1103,11 +1101,8 @@ func TestPRMergeTTY(t *testing.T) {
|
|||
cs.Register(`git rev-parse --verify refs/heads/blueberries`, 0, "")
|
||||
|
||||
as := prompt.NewAskStubber(t)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What merge method would you like to use?").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Delete the branch locally and on GitHub?").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What's next?").AnswerWith("Submit")
|
||||
|
||||
output, err := runCommand(http, "blueberries", true, "")
|
||||
|
|
@ -1167,9 +1162,7 @@ func TestPRMergeTTY_withDeleteBranch(t *testing.T) {
|
|||
cs.Register(`git pull --ff-only`, 0, "")
|
||||
|
||||
as := prompt.NewAskStubber(t)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What merge method would you like to use?").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What's next?").AnswerWith("Submit")
|
||||
|
||||
output, err := runCommand(http, "blueberries", true, "-d")
|
||||
|
|
@ -1228,15 +1221,10 @@ func TestPRMergeTTY_squashEditCommitMsgAndSubject(t *testing.T) {
|
|||
defer cmdTeardown(t)
|
||||
|
||||
as := prompt.NewAskStubber(t)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What merge method would you like to use?").AnswerWith("Squash and merge")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Delete the branch on GitHub?").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What's next?").AnswerWith("Edit commit message")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What's next?").AnswerWith("Edit commit subject")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What's next?").AnswerWith("Submit")
|
||||
|
||||
err := mergeRun(&MergeOptions{
|
||||
|
|
@ -1311,11 +1299,8 @@ func TestPRTTY_cancelled(t *testing.T) {
|
|||
cs.Register(`git rev-parse --verify refs/heads/`, 0, "")
|
||||
|
||||
as := prompt.NewAskStubber(t)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What merge method would you like to use?").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Delete the branch locally and on GitHub?").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What's next?").AnswerWith("Cancel")
|
||||
|
||||
output, err := runCommand(http, "blueberries", true, "")
|
||||
|
|
@ -1333,7 +1318,6 @@ func Test_mergeMethodSurvey(t *testing.T) {
|
|||
SquashMergeAllowed: true,
|
||||
}
|
||||
as := prompt.NewAskStubber(t)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What merge method would you like to use?").AnswerWith("Rebase and merge")
|
||||
|
||||
method, err := mergeMethodSurvey(repo)
|
||||
|
|
@ -1641,11 +1625,8 @@ func TestPrAddToMergeQueueAdmin(t *testing.T) {
|
|||
cs.Register(`git rev-parse --verify refs/heads/`, 0, "")
|
||||
|
||||
as := prompt.NewAskStubber(t)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What merge method would you like to use?").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Delete the branch locally and on GitHub?").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What's next?").AnswerDefault()
|
||||
|
||||
output, err := runCommand(http, "blueberries", true, "pr merge 1 --admin")
|
||||
|
|
|
|||
|
|
@ -43,18 +43,18 @@ func TestMetadataSurvey_selectAll(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, restoreAsk := prompt.InitAskStubber()
|
||||
defer restoreAsk()
|
||||
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{
|
||||
Name: "metadata",
|
||||
Value: []string{"Labels", "Projects", "Assignees", "Reviewers", "Milestone"},
|
||||
},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{
|
||||
Name: "reviewers",
|
||||
|
|
@ -112,18 +112,18 @@ func TestMetadataSurvey_keepExisting(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, restoreAsk := prompt.InitAskStubber()
|
||||
defer restoreAsk()
|
||||
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{
|
||||
Name: "metadata",
|
||||
Value: []string{"Labels", "Projects"},
|
||||
},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{
|
||||
Name: "labels",
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ func TestTemplateManager_hasAPI(t *testing.T) {
|
|||
assert.Equal(t, "LEGACY", string(m.LegacyBody()))
|
||||
|
||||
as := prompt.NewAskStubber(t)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Choose a template").
|
||||
AssertOptions([]string{"Bug report", "Feature request", "Open a blank issue"}).
|
||||
AnswerWith("Feature request")
|
||||
|
|
@ -95,7 +94,6 @@ func TestTemplateManager_hasAPI_PullRequest(t *testing.T) {
|
|||
assert.Equal(t, "LEGACY", string(m.LegacyBody()))
|
||||
|
||||
as := prompt.NewAskStubber(t)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Choose a template").
|
||||
AssertOptions([]string{"bug_pr.md", "feature_pr.md", "Open a blank pull request"}).
|
||||
AnswerWith("bug_pr.md")
|
||||
|
|
|
|||
|
|
@ -597,19 +597,14 @@ func Test_createRun_interactive(t *testing.T) {
|
|||
name: "create a release from existing tag",
|
||||
opts: &CreateOptions{},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Choose a tag").
|
||||
AssertOptions([]string{"v1.2.3", "v1.2.2", "v1.0.0", "v0.1.2", "Create a new tag"}).
|
||||
AnswerWith("v1.2.3")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Title (optional)").AnswerWith("")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Release notes").
|
||||
AssertOptions([]string{"Write my own", "Write using generated notes as template", "Leave blank"}).
|
||||
AnswerWith("Leave blank")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Is this a prerelease?").AnswerWith(false)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Submit?").
|
||||
AssertOptions([]string{"Publish release", "Save as draft", "Cancel"}).AnswerWith("Publish release")
|
||||
},
|
||||
|
|
@ -637,19 +632,13 @@ func Test_createRun_interactive(t *testing.T) {
|
|||
name: "create a release from new tag",
|
||||
opts: &CreateOptions{},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Choose a tag").AnswerWith("Create a new tag")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Tag name").AnswerWith("v1.2.3")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Title (optional)").AnswerWith("")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Release notes").
|
||||
AssertOptions([]string{"Write my own", "Write using generated notes as template", "Leave blank"}).
|
||||
AnswerWith("Leave blank")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Is this a prerelease?").AnswerWith(false)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Submit?").AnswerWith("Publish release")
|
||||
},
|
||||
runStubs: func(rs *run.CommandStubber) {
|
||||
|
|
@ -678,15 +667,11 @@ func Test_createRun_interactive(t *testing.T) {
|
|||
TagName: "v1.2.3",
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Title (optional)").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Release notes").
|
||||
AssertOptions([]string{"Write my own", "Write using generated notes as template", "Leave blank"}).
|
||||
AnswerWith("Write using generated notes as template")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Is this a prerelease?").AnswerWith(false)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Submit?").AnswerWith("Publish release")
|
||||
},
|
||||
runStubs: func(rs *run.CommandStubber) {
|
||||
|
|
@ -720,15 +705,11 @@ func Test_createRun_interactive(t *testing.T) {
|
|||
TagName: "v1.2.3",
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Title (optional)").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Release notes").
|
||||
AssertOptions([]string{"Write my own", "Write using commit log as template", "Leave blank"}).
|
||||
AnswerWith("Write using commit log as template")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Is this a prerelease?").AnswerWith(false)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Submit?").AnswerWith("Publish release")
|
||||
},
|
||||
runStubs: func(rs *run.CommandStubber) {
|
||||
|
|
@ -760,15 +741,11 @@ func Test_createRun_interactive(t *testing.T) {
|
|||
TagName: "v1.2.3",
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Title (optional)").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Release notes").
|
||||
AssertOptions([]string{"Write my own", "Write using git tag message as template", "Leave blank"}).
|
||||
AnswerWith("Write using git tag message as template")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Is this a prerelease?").AnswerWith(false)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Submit?").AnswerWith("Publish release")
|
||||
},
|
||||
runStubs: func(rs *run.CommandStubber) {
|
||||
|
|
@ -816,15 +793,11 @@ func Test_createRun_interactive(t *testing.T) {
|
|||
Target: "main",
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Title (optional)").AnswerWith("")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Release notes").
|
||||
AssertOptions([]string{"Write my own", "Write using generated notes as template", "Write using git tag message as template", "Leave blank"}).
|
||||
AnswerWith("Leave blank")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Is this a prerelease?").AnswerWith(false)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Submit?").AnswerWith("Publish release")
|
||||
},
|
||||
runStubs: func(rs *run.CommandStubber) {
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ func Test_ArchiveRun(t *testing.T) {
|
|||
name: "unarchived repo tty",
|
||||
wantStdout: "✓ Archived repository OWNER/REPO\n",
|
||||
askStubs: func(q *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne(true)
|
||||
},
|
||||
isTTY: true,
|
||||
|
|
@ -99,7 +99,7 @@ func Test_ArchiveRun(t *testing.T) {
|
|||
wantStdout: "✓ Archived repository OWNER/REPO\n",
|
||||
opts: ArchiveOptions{},
|
||||
askStubs: func(q *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne(true)
|
||||
},
|
||||
isTTY: true,
|
||||
|
|
@ -140,7 +140,7 @@ func Test_ArchiveRun(t *testing.T) {
|
|||
ios, _, stdout, stderr := iostreams.Test()
|
||||
tt.opts.IO = ios
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
q, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -187,30 +187,30 @@ func Test_createRun(t *testing.T) {
|
|||
tty: true,
|
||||
wantStdout: "✓ Created repository OWNER/REPO on GitHub\n",
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Create a new repository on GitHub from scratch")
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "repoName", Value: "REPO"},
|
||||
{Name: "repoDescription", Value: "my new repo"},
|
||||
{Name: "repoVisibility", Value: "Private"},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "addGitIgnore", Value: true}})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "chooseGitIgnore", Value: "Go"}})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "addLicense", Value: true}})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "chooseLicense", Value: "GNU Lesser General Public License v3.0"}})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "confirmSubmit", Value: true}})
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true) //clone locally?
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -234,21 +234,21 @@ func Test_createRun(t *testing.T) {
|
|||
opts: &CreateOptions{Interactive: true},
|
||||
tty: true,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Create a new repository on GitHub from scratch")
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "repoName", Value: "REPO"},
|
||||
{Name: "repoDescription", Value: "my new repo"},
|
||||
{Name: "repoVisibility", Value: "Private"},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "addGitIgnore", Value: false}})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "addLicense", Value: false}})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "confirmSubmit", Value: false}})
|
||||
},
|
||||
|
|
@ -261,17 +261,17 @@ func Test_createRun(t *testing.T) {
|
|||
opts: &CreateOptions{Interactive: true},
|
||||
tty: true,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Push an existing local repository to GitHub")
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(".")
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "repoName", Value: "REPO"},
|
||||
{Name: "repoDescription", Value: "my new repo"},
|
||||
{Name: "repoVisibility", Value: "Private"},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(false)
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -302,21 +302,21 @@ func Test_createRun(t *testing.T) {
|
|||
opts: &CreateOptions{Interactive: true},
|
||||
tty: true,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Push an existing local repository to GitHub")
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(".")
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "repoName", Value: "REPO"},
|
||||
{Name: "repoDescription", Value: "my new repo"},
|
||||
{Name: "repoVisibility", Value: "Private"},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true) //ask for adding a remote
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("origin") //ask for remote name
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(false) //ask to push to remote
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -348,21 +348,21 @@ func Test_createRun(t *testing.T) {
|
|||
opts: &CreateOptions{Interactive: true},
|
||||
tty: true,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Push an existing local repository to GitHub")
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(".")
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "repoName", Value: "REPO"},
|
||||
{Name: "repoDescription", Value: "my new repo"},
|
||||
{Name: "repoVisibility", Value: "Private"},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true) //ask for adding a remote
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("origin") //ask for remote name
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true) //ask to push to remote
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -452,7 +452,7 @@ func Test_createRun(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
q, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -173,9 +173,7 @@ func Test_editRun_interactive(t *testing.T) {
|
|||
InteractiveMode: true,
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What do you want to edit?").AnswerWith([]string{"Description"})
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Description of the repository").AnswerWith("awesome repo description")
|
||||
},
|
||||
httpStubs: func(t *testing.T, reg *httpmock.Registry) {
|
||||
|
|
@ -215,13 +213,9 @@ func Test_editRun_interactive(t *testing.T) {
|
|||
InteractiveMode: true,
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What do you want to edit?").AnswerWith([]string{"Description", "Topics"})
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Description of the repository").AnswerWith("awesome repo description")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Add topics?(csv format)").AnswerWith("a, b,c,d ")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Remove Topics").AnswerWith([]string{"x"})
|
||||
},
|
||||
httpStubs: func(t *testing.T, reg *httpmock.Registry) {
|
||||
|
|
@ -266,13 +260,9 @@ func Test_editRun_interactive(t *testing.T) {
|
|||
InteractiveMode: true,
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("What do you want to edit?").AnswerWith([]string{"Merge Options"})
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Allowed merge strategies").AnswerWith([]string{allowMergeCommits, allowRebaseMerge})
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Enable Auto Merge?").AnswerWith(false)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Automatically delete head branches after merging?").AnswerWith(false)
|
||||
},
|
||||
httpStubs: func(t *testing.T, reg *httpmock.Registry) {
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ func TestRepoFork(t *testing.T) {
|
|||
},
|
||||
httpStubs: forkPost,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(false)
|
||||
},
|
||||
wantErrOut: "✓ Created fork someone/REPO\n",
|
||||
|
|
@ -291,7 +291,7 @@ func TestRepoFork(t *testing.T) {
|
|||
cs.Register(`git remote add -f origin https://github.com/someone/REPO.git`, 0, "")
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true)
|
||||
},
|
||||
wantErrOut: "✓ Created fork someone/REPO\n✓ Added remote origin\n",
|
||||
|
|
@ -494,7 +494,7 @@ func TestRepoFork(t *testing.T) {
|
|||
},
|
||||
httpStubs: forkPost,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(false)
|
||||
},
|
||||
wantErrOut: "✓ Created fork someone/REPO\n",
|
||||
|
|
@ -508,7 +508,7 @@ func TestRepoFork(t *testing.T) {
|
|||
},
|
||||
httpStubs: forkPost,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true)
|
||||
},
|
||||
execStubs: func(cs *run.CommandStubber) {
|
||||
|
|
@ -529,7 +529,7 @@ func TestRepoFork(t *testing.T) {
|
|||
},
|
||||
httpStubs: forkPost,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true)
|
||||
},
|
||||
execStubs: func(cs *run.CommandStubber) {
|
||||
|
|
@ -700,7 +700,7 @@ func TestRepoFork(t *testing.T) {
|
|||
return tt.remotes, nil
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ func TestRenameRun(t *testing.T) {
|
|||
name: "none argument",
|
||||
wantOut: "✓ Renamed repository OWNER/NEW_REPO\n✓ Updated the \"origin\" remote\n",
|
||||
askStubs: func(q *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne("NEW_REPO")
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -137,7 +137,7 @@ func TestRenameRun(t *testing.T) {
|
|||
},
|
||||
wantOut: "✓ Renamed repository OWNER/NEW_REPO\n",
|
||||
askStubs: func(q *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne("NEW_REPO")
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -186,7 +186,7 @@ func TestRenameRun(t *testing.T) {
|
|||
},
|
||||
wantOut: "✓ Renamed repository OWNER/NEW_REPO\n✓ Updated the \"origin\" remote\n",
|
||||
askStubs: func(q *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne(true)
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -207,7 +207,7 @@ func TestRenameRun(t *testing.T) {
|
|||
DoConfirm: true,
|
||||
},
|
||||
askStubs: func(q *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne(false)
|
||||
},
|
||||
wantOut: "",
|
||||
|
|
@ -215,7 +215,7 @@ func TestRenameRun(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tt := range testCases {
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
q, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ func TestRunCancel(t *testing.T) {
|
|||
httpmock.StatusStringResponse(202, "{}"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(0)
|
||||
},
|
||||
wantOut: "✓ Request to cancel workflow submitted.\n",
|
||||
|
|
@ -196,7 +196,7 @@ func TestRunCancel(t *testing.T) {
|
|||
return ghrepo.FromFullName("OWNER/REPO")
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ func TestRerun(t *testing.T) {
|
|||
httpmock.StringResponse("{}"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2)
|
||||
},
|
||||
wantOut: "✓ Requested rerun of run 1234\n",
|
||||
|
|
@ -351,7 +351,7 @@ func TestRerun(t *testing.T) {
|
|||
return ghrepo.FromFullName("OWNER/REPO")
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.JSONResponse([]shared.Annotation{}))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2)
|
||||
},
|
||||
opts: &ViewOptions{
|
||||
|
|
@ -411,9 +411,9 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.FileResponse("./fixtures/run_log.zip"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2)
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(1)
|
||||
},
|
||||
wantOut: coolJobRunLogOutput,
|
||||
|
|
@ -466,9 +466,9 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.FileResponse("./fixtures/run_log.zip"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2)
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(0)
|
||||
},
|
||||
wantOut: expectedRunLogOutput,
|
||||
|
|
@ -527,9 +527,9 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.FileResponse("./fixtures/run_log.zip"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(4)
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2)
|
||||
},
|
||||
wantOut: quuxTheBarfLogOutput,
|
||||
|
|
@ -582,9 +582,9 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.FileResponse("./fixtures/run_log.zip"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(4)
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(0)
|
||||
},
|
||||
wantOut: quuxTheBarfLogOutput,
|
||||
|
|
@ -708,9 +708,9 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.JSONResponse(shared.FailedJobAnnotations))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2)
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(0)
|
||||
},
|
||||
wantOut: "\n✓ trunk successful · 3\nTriggered via push about 59 minutes ago\n\nJOBS\n✓ cool job in 4m34s (ID 10)\nX sad job in 4m34s (ID 20)\n ✓ barf the quux\n X quux the barf\n\nANNOTATIONS\nX the job is sad\nsad job: blaze.py#420\n\n\nFor more information about a job, try: gh run view --job=<job-id>\nView this run on GitHub: https://github.com/runs/3\n",
|
||||
|
|
@ -743,9 +743,9 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.JSONResponse([]shared.Annotation{}))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2)
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated; use PrompterMock
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(1)
|
||||
},
|
||||
wantOut: "\n✓ trunk successful · 3\nTriggered via push about 59 minutes ago\n\n✓ cool job in 4m34s (ID 10)\n ✓ fob the barz\n ✓ barz the fob\n\nTo see the full job log, try: gh run view --log --job=10\nView this run on GitHub: https://github.com/runs/3\n",
|
||||
|
|
@ -842,7 +842,7 @@ func TestViewRun(t *testing.T) {
|
|||
return ghrepo.FromFullName("OWNER/REPO")
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use PrompterMock
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -230,7 +230,6 @@ func TestWatchRun(t *testing.T) {
|
|||
},
|
||||
httpStubs: successfulRunStubs,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Select a workflow run").
|
||||
AssertOptions([]string{"* cool commit, run (trunk) Feb 23, 2021", "* cool commit, more runs (trunk) Feb 23, 2021"}).
|
||||
AnswerWith("* cool commit, more runs (trunk) Feb 23, 2021")
|
||||
|
|
@ -247,7 +246,6 @@ func TestWatchRun(t *testing.T) {
|
|||
},
|
||||
httpStubs: failedRunStubs,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Select a workflow run").
|
||||
AssertOptions([]string{"* cool commit, run (trunk) Feb 23, 2021", "* cool commit, more runs (trunk) Feb 23, 2021"}).
|
||||
AnswerWith("* cool commit, more runs (trunk) Feb 23, 2021")
|
||||
|
|
|
|||
|
|
@ -561,7 +561,6 @@ func Test_getBodyPrompt(t *testing.T) {
|
|||
ios.SetStdoutTTY(true)
|
||||
|
||||
as := prompt.NewAskStubber(t)
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Paste your secret").AnswerWith("cool secret")
|
||||
|
||||
body, err := getBody(&SetOptions{
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ func TestDisableRun(t *testing.T) {
|
|||
httpmock.StatusStringResponse(204, "{}"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Select a workflow").AnswerWith("another workflow (another.yml)")
|
||||
},
|
||||
wantOut: "✓ Disabled another workflow\n",
|
||||
|
|
@ -177,7 +176,6 @@ func TestDisableRun(t *testing.T) {
|
|||
httpmock.StatusStringResponse(204, "{}"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Which workflow do you mean?").AnswerWith("another workflow (yetanother.yml)")
|
||||
},
|
||||
wantOut: "✓ Disabled another workflow\n",
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ func TestEnableRun(t *testing.T) {
|
|||
httpmock.StatusStringResponse(204, "{}"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Select a workflow").AnswerWith("a disabled workflow (disabled.yml)")
|
||||
},
|
||||
wantOut: "✓ Enabled a disabled workflow\n",
|
||||
|
|
@ -177,7 +176,6 @@ func TestEnableRun(t *testing.T) {
|
|||
httpmock.StatusStringResponse(204, "{}"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Which workflow do you mean?").AnswerWith("a disabled workflow (anotherDisabled.yml)")
|
||||
},
|
||||
wantOut: "✓ Enabled a disabled workflow\n",
|
||||
|
|
|
|||
|
|
@ -558,7 +558,6 @@ jobs:
|
|||
httpmock.StatusStringResponse(204, "cool"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Select a workflow").AnswerDefault()
|
||||
},
|
||||
wantBody: map[string]interface{}{
|
||||
|
|
@ -596,11 +595,8 @@ jobs:
|
|||
httpmock.StatusStringResponse(204, "cool"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("Select a workflow").AnswerDefault()
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("greeting").AnswerWith("hi")
|
||||
//nolint:staticcheck // SA1019: as.StubPrompt is deprecated: use PrompterMock
|
||||
as.StubPrompt("name").AnswerWith("scully")
|
||||
},
|
||||
wantBody: map[string]interface{}{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ type testing interface {
|
|||
Cleanup(func())
|
||||
}
|
||||
|
||||
// Deprecated: use PrompterMock
|
||||
func NewAskStubber(t testing) *AskStubber {
|
||||
as, teardown := InitAskStubber()
|
||||
t.Cleanup(func() {
|
||||
|
|
@ -32,7 +31,7 @@ func NewAskStubber(t testing) *AskStubber {
|
|||
return as
|
||||
}
|
||||
|
||||
// Deprecated: use PrompterMock
|
||||
// Deprecated: use NewAskStubber
|
||||
func InitAskStubber() (*AskStubber, func()) {
|
||||
origSurveyAsk := SurveyAsk
|
||||
origSurveyAskOne := SurveyAskOne
|
||||
|
|
@ -158,38 +157,34 @@ type QuestionStub struct {
|
|||
}
|
||||
|
||||
// AssertOptions asserts the options presented to the user in Selects and MultiSelects.
|
||||
// Deprecated: use PrompterMock
|
||||
func (s *QuestionStub) AssertOptions(opts []string) *QuestionStub {
|
||||
s.options = opts
|
||||
return s
|
||||
}
|
||||
|
||||
// AnswerWith defines an answer for the given stub.
|
||||
// Deprecated: use PrompterMock
|
||||
func (s *QuestionStub) AnswerWith(v interface{}) *QuestionStub {
|
||||
s.Value = v
|
||||
return s
|
||||
}
|
||||
|
||||
// AnswerDefault marks the current stub to be answered with the default value for the prompt question.
|
||||
// Deprecated: use PrompterMock
|
||||
func (s *QuestionStub) AnswerDefault() *QuestionStub {
|
||||
s.Default = true
|
||||
return s
|
||||
}
|
||||
|
||||
// Deprecated: use PrompterMock
|
||||
// Deprecated: use StubPrompt
|
||||
func (as *AskStubber) StubOne(value interface{}) {
|
||||
as.Stub([]*QuestionStub{{Value: value}})
|
||||
}
|
||||
|
||||
// Deprecated: use PrompterMock
|
||||
// Deprecated: use StubPrompt
|
||||
func (as *AskStubber) Stub(stubbedQuestions []*QuestionStub) {
|
||||
as.stubs = append(as.stubs, stubbedQuestions...)
|
||||
}
|
||||
|
||||
// StubPrompt records a stub for an interactive prompt matched by its message.
|
||||
// Deprecated: use PrompterMock
|
||||
func (as *AskStubber) StubPrompt(msg string) *QuestionStub {
|
||||
stub := &QuestionStub{message: msg}
|
||||
as.stubs = append(as.stubs, stub)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue