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

Function Test_RepoClone_withoutUsername

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

Source from the content-addressed store, hash-verified

325}
326
327func Test_RepoClone_withoutUsername(t *testing.T) {
328 reg := &httpmock.Registry{}
329 defer reg.Verify(t)
330 reg.Register(
331 httpmock.GraphQL(`query UserCurrent\b`),
332 httpmock.StringResponse(`
333 { "data": { "viewer": {
334 "login": "OWNER"
335 }}}`))
336 reg.Register(
337 httpmock.GraphQL(`query RepositoryInfo\b`),
338 httpmock.StringResponse(`
339 { "data": { "repository": {
340 "name": "REPO",
341 "owner": {
342 "login": "OWNER"
343 }
344 } } }
345 `))
346
347 httpClient := &http.Client{Transport: reg}
348
349 cs, restore := run.Stub()
350 defer restore(t)
351 cs.Register(`git clone https://github\.com/OWNER/REPO\.git`, 0, "")
352
353 output, err := runCloneCommand(httpClient, "REPO")
354 if err != nil {
355 t.Fatalf("error running command `repo clone`: %v", err)
356 }
357
358 assert.Equal(t, "", output.String())
359 assert.Equal(t, "", output.Stderr())
360}
361
362func Test_RepoClone_hasParent_noUpstream(t *testing.T) {
363 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.45

Tested by

no test coverage detected