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

Function Test_editRun

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

Source from the content-addressed store, hash-verified

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

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