(t *testing.T)
| 411 | } |
| 412 | |
| 413 | func 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 | }, |
nothing calls this directly
no test coverage detected