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