MCPcopy
hub / github.com/cli/cli / Test_RepoClone_hasParent_upstreamRemoteName

Function Test_RepoClone_hasParent_upstreamRemoteName

pkg/cmd/repo/clone/clone_test.go:287–325  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

285}
286
287func Test_RepoClone_hasParent_upstreamRemoteName(t *testing.T) {
288 reg := &httpmock.Registry{}
289 defer reg.Verify(t)
290 reg.Register(
291 httpmock.GraphQL(`query RepositoryInfo\b`),
292 httpmock.StringResponse(`
293 { "data": { "repository": {
294 "name": "REPO",
295 "owner": {
296 "login": "OWNER"
297 },
298 "parent": {
299 "name": "ORIG",
300 "owner": {
301 "login": "hubot"
302 },
303 "defaultBranchRef": {
304 "name": "trunk"
305 }
306 }
307 } } }
308 `))
309
310 httpClient := &http.Client{Transport: reg}
311
312 cs, cmdTeardown := run.Stub()
313 defer cmdTeardown(t)
314
315 cs.Register(`git clone https://github.com/OWNER/REPO.git`, 0, "")
316 cs.Register(`git -C REPO remote add -t trunk test https://github.com/hubot/ORIG.git`, 0, "")
317 cs.Register(`git -C REPO fetch test`, 0, "")
318 cs.Register(`git -C REPO remote set-branches test *`, 0, "")
319 cs.Register(`git -C REPO config --add remote.test.gh-resolved base`, 0, "")
320
321 _, err := runCloneCommand(httpClient, "OWNER/REPO --upstream-remote-name test")
322 if err != nil {
323 t.Fatalf("error running command `repo clone`: %v", err)
324 }
325}
326
327func Test_RepoClone_withoutUsername(t *testing.T) {
328 reg := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 6

VerifyMethod · 0.95
RegisterMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
StubFunction · 0.92
runCloneCommandFunction · 0.70

Tested by

no test coverage detected