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

Function Test_editRun

pkg/cmd/pr/edit/edit_test.go:432–1714  ·  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 uploads []attachments.UploadStub
439 // Empty means the row does not care which host was reached.
440 wantUploadHost string
441 wantLookupFields []string
442 wantNoLookupFields []string
443 stdout string
444 stderr string
445 wantErr string
446 wantOperations *attachments.UploadResult
447 }{
448 {
449 name: "non-interactive",
450 input: &EditOptions{
451 Detector: &fd.EnabledDetectorMock{},
452 SelectorArg: "123",
453 Finder: shared.NewMockFinder("123", &api.PullRequest{
454 URL: "https://github.com/OWNER/REPO/pull/123",
455 }, ghrepo.New("OWNER", "REPO")),
456 Interactive: false,
457 Title: shared.EditableString{
458 Value: "new title",
459 Edited: true,
460 },
461 Body: shared.EditableString{
462 Value: "new body",
463 Edited: true,
464 },
465 Base: shared.EditableString{
466 Value: "base-branch-name",
467 Edited: true,
468 },
469 Reviewers: shared.EditableReviewers{EditableSlice: shared.EditableSlice{
470 Add: []string{"OWNER/core", "OWNER/external", "monalisa", "hubot"},
471 Remove: []string{"dependabot"},
472 Edited: true,
473 }},
474 Assignees: shared.EditableAssignees{
475 EditableSlice: shared.EditableSlice{
476 Add: []string{"monalisa", "hubot"},
477 Remove: []string{"octocat"},
478 Edited: true,
479 },
480 },
481 Labels: shared.EditableSlice{
482 Add: []string{"feature", "TODO", "bug"},
483 Remove: []string{"docs"},
484 Edited: true,
485 },
486 Projects: shared.EditableProjects{
487 EditableSlice: shared.EditableSlice{
488 Add: []string{"Cleanup", "CleanupV2"},
489 Remove: []string{"Roadmap", "RoadmapV2"},

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