(t *testing.T)
| 245 | } |
| 246 | |
| 247 | func Test_RepoClone_hasParent(t *testing.T) { |
| 248 | reg := &httpmock.Registry{} |
| 249 | defer reg.Verify(t) |
| 250 | reg.Register( |
| 251 | httpmock.GraphQL(`query RepositoryInfo\b`), |
| 252 | httpmock.StringResponse(` |
| 253 | { "data": { "repository": { |
| 254 | "name": "REPO", |
| 255 | "owner": { |
| 256 | "login": "OWNER" |
| 257 | }, |
| 258 | "parent": { |
| 259 | "name": "ORIG", |
| 260 | "owner": { |
| 261 | "login": "hubot" |
| 262 | }, |
| 263 | "defaultBranchRef": { |
| 264 | "name": "trunk" |
| 265 | } |
| 266 | } |
| 267 | } } } |
| 268 | `)) |
| 269 | |
| 270 | httpClient := &http.Client{Transport: reg} |
| 271 | |
| 272 | cs, cmdTeardown := run.Stub() |
| 273 | defer cmdTeardown(t) |
| 274 | |
| 275 | cs.Register(`git clone https://github.com/OWNER/REPO.git`, 0, "") |
| 276 | cs.Register(`git -C REPO remote add -t trunk upstream https://github.com/hubot/ORIG.git`, 0, "") |
| 277 | cs.Register(`git -C REPO fetch upstream`, 0, "") |
| 278 | cs.Register(`git -C REPO remote set-branches upstream *`, 0, "") |
| 279 | cs.Register(`git -C REPO config --add remote.upstream.gh-resolved base`, 0, "") |
| 280 | |
| 281 | _, err := runCloneCommand(httpClient, "OWNER/REPO") |
| 282 | if err != nil { |
| 283 | t.Fatalf("error running command `repo clone`: %v", err) |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | func Test_RepoClone_hasParent_upstreamRemoteName(t *testing.T) { |
| 288 | reg := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected