(t *testing.T)
| 950 | } |
| 951 | |
| 952 | func TestPRCheckout_differentRepo_remoteExists(t *testing.T) { |
| 953 | remotes := context.Remotes{ |
| 954 | { |
| 955 | Remote: &git.Remote{Name: "origin"}, |
| 956 | Repo: ghrepo.New("OWNER", "REPO"), |
| 957 | }, |
| 958 | { |
| 959 | Remote: &git.Remote{Name: "robot-fork"}, |
| 960 | Repo: ghrepo.New("hubot", "REPO"), |
| 961 | }, |
| 962 | } |
| 963 | |
| 964 | http := &httpmock.Registry{} |
| 965 | defer http.Verify(t) |
| 966 | |
| 967 | baseRepo, pr := stubPR("OWNER/REPO", "hubot/REPO:feature") |
| 968 | finder := shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo) |
| 969 | finder.ExpectFields([]string{"number", "headRefName", "headRepository", "headRepositoryOwner", "isCrossRepository", "maintainerCanModify"}) |
| 970 | |
| 971 | cs, cmdTeardown := run.Stub() |
| 972 | defer cmdTeardown(t) |
| 973 | cs.Register(`git fetch robot-fork \+refs/heads/feature:refs/remotes/robot-fork/feature --no-tags`, 0, "") |
| 974 | cs.Register(`git show-ref --verify -- refs/heads/feature`, 1, "") |
| 975 | cs.Register(`git checkout -b feature --track robot-fork/feature`, 0, "") |
| 976 | |
| 977 | output, err := runCommand(http, remotes, "master", `123`, baseRepo) |
| 978 | assert.NoError(t, err) |
| 979 | assert.Equal(t, "", output.String()) |
| 980 | assert.Equal(t, "", output.Stderr()) |
| 981 | } |
| 982 | |
| 983 | func TestPRCheckout_differentRepo(t *testing.T) { |
| 984 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected