MCPcopy Create free account
hub / github.com/cli/cli / Test_editRun

Function Test_editRun

pkg/cmd/pr/edit/edit_test.go:413–1712  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

411}
412
413func Test_editRun(t *testing.T) {
414 tests := []struct {
415 name string
416 input *EditOptions
417 httpStubs func(*testing.T, *httpmock.Registry)
418 attach []string
419 // Empty means the default token, which can upload.
420 token string
421 // Overrides token, for a row that needs more than one host.
422 hostTokens map[string]string
423 uploads []attachments.UploadStub
424 // Empty means the row does not care which host was reached.
425 wantUploadHost string
426 wantLookupFields []string
427 wantNoLookupFields []string
428 stdout string
429 stderr string
430 wantErr string
431 }{
432 {
433 name: "non-interactive",
434 input: &EditOptions{
435 Detector: &fd.EnabledDetectorMock{},
436 SelectorArg: "123",
437 Finder: shared.NewMockFinder("123", &api.PullRequest{
438 URL: "https://github.com/OWNER/REPO/pull/123",
439 }, ghrepo.New("OWNER", "REPO")),
440 Interactive: false,
441 Editable: shared.Editable{
442 Title: shared.EditableString{
443 Value: "new title",
444 Edited: true,
445 },
446 Body: shared.EditableString{
447 Value: "new body",
448 Edited: true,
449 },
450 Base: shared.EditableString{
451 Value: "base-branch-name",
452 Edited: true,
453 },
454 Reviewers: shared.EditableReviewers{EditableSlice: shared.EditableSlice{
455 Add: []string{"OWNER/core", "OWNER/external", "monalisa", "hubot"},
456 Remove: []string{"dependabot"},
457 Edited: true,
458 }},
459 Assignees: shared.EditableAssignees{
460 EditableSlice: shared.EditableSlice{
461 Add: []string{"monalisa", "hubot"},
462 Remove: []string{"octocat"},
463 Edited: true,
464 },
465 },
466 Labels: shared.EditableSlice{
467 Add: []string{"feature", "TODO", "bug"},
468 Remove: []string{"docs"},
469 Edited: true,
470 },

Callers

nothing calls this directly

Calls 15

RegisterMethod · 0.95
ExcludeMethod · 0.95
VerifyMethod · 0.95
NewMockFinderFunction · 0.92
NewFunction · 0.92
GraphQLFunction · 0.92
GraphQLMutationFunction · 0.92
NewAssignableBotFunction · 0.92
NewAssignableUserFunction · 0.92
StringResponseFunction · 0.92
RESTFunction · 0.92
StatusStringResponseFunction · 0.92

Tested by

no test coverage detected