(t *testing.T)
| 555 | } |
| 556 | |
| 557 | func TestPRCheckout_differentRepo_remoteExists(t *testing.T) { |
| 558 | remotes := context.Remotes{ |
| 559 | { |
| 560 | Remote: &git.Remote{Name: "origin"}, |
| 561 | Repo: ghrepo.New("OWNER", "REPO"), |
| 562 | }, |
| 563 | { |
| 564 | Remote: &git.Remote{Name: "robot-fork"}, |
| 565 | Repo: ghrepo.New("hubot", "REPO"), |
| 566 | }, |
| 567 | } |
| 568 | |
| 569 | http := &httpmock.Registry{} |
| 570 | defer http.Verify(t) |
| 571 | |
| 572 | baseRepo, pr := stubPR("OWNER/REPO", "hubot/REPO:feature") |
| 573 | finder := shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo) |
| 574 | finder.ExpectFields([]string{"number", "headRefName", "headRepository", "headRepositoryOwner", "isCrossRepository", "maintainerCanModify"}) |
| 575 | |
| 576 | cs, cmdTeardown := run.Stub() |
| 577 | defer cmdTeardown(t) |
| 578 | cs.Register(`git fetch robot-fork \+refs/heads/feature:refs/remotes/robot-fork/feature --no-tags`, 0, "") |
| 579 | cs.Register(`git show-ref --verify -- refs/heads/feature`, 1, "") |
| 580 | cs.Register(`git checkout -b feature --track robot-fork/feature`, 0, "") |
| 581 | |
| 582 | output, err := runCommand(http, remotes, "master", `123`, baseRepo) |
| 583 | assert.NoError(t, err) |
| 584 | assert.Equal(t, "", output.String()) |
| 585 | assert.Equal(t, "", output.Stderr()) |
| 586 | } |
| 587 | |
| 588 | func TestPRCheckout_differentRepo(t *testing.T) { |
| 589 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected