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

Function TestPRCheckout_differentRepo_remoteExists

pkg/cmd/pr/checkout/checkout_test.go:557–586  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

555}
556
557func TestPRCheckout_differentRepo_remoteExists(t *testing.T) {
558 remotes := context.Remotes{
559 {
560 Remote: &git.Remote{Name: "origin"},
561 Repo: ghrepo.New("OWNER", "REPO"),
562 },
563 {
564 Remote: &git.Remote{Name: "robot-fork"},
565 Repo: ghrepo.New("hubot", "REPO"),
566 },
567 }
568
569 http := &httpmock.Registry{}
570 defer http.Verify(t)
571
572 baseRepo, pr := stubPR("OWNER/REPO", "hubot/REPO:feature")
573 finder := shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)
574 finder.ExpectFields([]string{"number", "headRefName", "headRepository", "headRepositoryOwner", "isCrossRepository", "maintainerCanModify"})
575
576 cs, cmdTeardown := run.Stub()
577 defer cmdTeardown(t)
578 cs.Register(`git fetch robot-fork \+refs/heads/feature:refs/remotes/robot-fork/feature --no-tags`, 0, "")
579 cs.Register(`git show-ref --verify -- refs/heads/feature`, 1, "")
580 cs.Register(`git checkout -b feature --track robot-fork/feature`, 0, "")
581
582 output, err := runCommand(http, remotes, "master", `123`, baseRepo)
583 assert.NoError(t, err)
584 assert.Equal(t, "", output.String())
585 assert.Equal(t, "", output.Stderr())
586}
587
588func TestPRCheckout_differentRepo(t *testing.T) {
589 http := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 11

VerifyMethod · 0.95
NewFunction · 0.92
StubFunction · 0.92
EqualMethod · 0.80
StderrMethod · 0.80
stubPRFunction · 0.70
runCommandFunction · 0.70
ExpectFieldsMethod · 0.45
RegisterMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected