MCPcopy Create free account
hub / github.com/cli/cli / Test_RepoClone_withoutUsername

Function Test_RepoClone_withoutUsername

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

Source from the content-addressed store, hash-verified

411}
412
413func Test_RepoClone_withoutUsername(t *testing.T) {
414 reg := &httpmock.Registry{}
415 defer reg.Verify(t)
416 reg.Register(
417 httpmock.GraphQL(`query UserCurrent\b`),
418 httpmock.StringResponse(`
419 { "data": { "viewer": {
420 "login": "OWNER"
421 }}}`))
422 reg.Register(
423 httpmock.GraphQL(`query RepositoryInfo\b`),
424 httpmock.StringResponse(`
425 { "data": { "repository": {
426 "name": "REPO",
427 "owner": {
428 "login": "OWNER"
429 }
430 } } }
431 `))
432
433 httpClient := &http.Client{Transport: reg}
434
435 cs, restore := run.Stub()
436 defer restore(t)
437 cs.Register(`git clone https://github\.com/OWNER/REPO\.git`, 0, "")
438
439 output, err := runCloneCommand(httpClient, "REPO")
440 if err != nil {
441 t.Fatalf("error running command `repo clone`: %v", err)
442 }
443
444 assert.Equal(t, "", output.String())
445 assert.Equal(t, "", output.Stderr())
446}
447
448func Test_RepoClone_hasParent_noUpstream(t *testing.T) {
449 reg := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 9

VerifyMethod · 0.95
RegisterMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
StubFunction · 0.92
EqualMethod · 0.80
StderrMethod · 0.80
runCloneCommandFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected