MCPcopy Index your code
hub / github.com/cli/cli / Test_RepoClone_hasParent

Function Test_RepoClone_hasParent

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

Source from the content-addressed store, hash-verified

245}
246
247func 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
287func Test_RepoClone_hasParent_upstreamRemoteName(t *testing.T) {
288 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