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

Function Test_editRun

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

Source from the content-addressed store, hash-verified

430}
431
432func Test_editRun(t *testing.T) {
433 tests := []struct {
434 name string
435 input *EditOptions
436 httpStubs func(*testing.T, *httpmock.Registry)
437 attach []string
438 // Empty means the default token, which can upload.
439 token string
440 // Overrides token, for a row that needs more than one host.
441 hostTokens map[string]string
442 uploads []attachments.UploadStub
443 // Empty means the row does not care which host was reached.
444 wantUploadHost string
445 wantLookupFields []string
446 wantNoLookupFields []string
447 stdout string
448 stderr string
449 wantErr string
450 wantOperations *attachments.UploadResult
451 }{
452 {
453 name: "non-interactive",
454 input: &EditOptions{
455 Detector: &fd.EnabledDetectorMock{},
456 SelectorArg: "123",
457 Finder: shared.NewMockFinder("123", &api.PullRequest{
458 URL: "https://github.com/OWNER/REPO/pull/123",
459 }, ghrepo.New("OWNER", "REPO")),
460 Interactive: false,
461 Title: shared.EditableString{
462 Value: "new title",
463 Edited: true,
464 },
465 Body: shared.EditableString{
466 Value: "new body",
467 Edited: true,
468 },
469 Base: shared.EditableString{
470 Value: "base-branch-name",
471 Edited: true,
472 },
473 Reviewers: shared.EditableReviewers{EditableSlice: shared.EditableSlice{
474 Add: []string{"OWNER/core", "OWNER/external", "monalisa", "hubot"},
475 Remove: []string{"dependabot"},
476 Edited: true,
477 }},
478 Assignees: shared.EditableAssignees{
479 EditableSlice: shared.EditableSlice{
480 Add: []string{"monalisa", "hubot"},
481 Remove: []string{"octocat"},
482 Edited: true,
483 },
484 },
485 Labels: shared.EditableSlice{
486 Add: []string{"feature", "TODO", "bug"},
487 Remove: []string{"docs"},
488 Edited: true,
489 },

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