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