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

Function TestPRCheckout_differentRepo_remoteExists

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

Source from the content-addressed store, hash-verified

950}
951
952func TestPRCheckout_differentRepo_remoteExists(t *testing.T) {
953 remotes := context.Remotes{
954 {
955 Remote: &git.Remote{Name: "origin"},
956 Repo: ghrepo.New("OWNER", "REPO"),
957 },
958 {
959 Remote: &git.Remote{Name: "robot-fork"},
960 Repo: ghrepo.New("hubot", "REPO"),
961 },
962 }
963
964 http := &httpmock.Registry{}
965 defer http.Verify(t)
966
967 baseRepo, pr := stubPR("OWNER/REPO", "hubot/REPO:feature")
968 finder := shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)
969 finder.ExpectFields([]string{"number", "headRefName", "headRepository", "headRepositoryOwner", "isCrossRepository", "maintainerCanModify"})
970
971 cs, cmdTeardown := run.Stub()
972 defer cmdTeardown(t)
973 cs.Register(`git fetch robot-fork \+refs/heads/feature:refs/remotes/robot-fork/feature --no-tags`, 0, "")
974 cs.Register(`git show-ref --verify -- refs/heads/feature`, 1, "")
975 cs.Register(`git checkout -b feature --track robot-fork/feature`, 0, "")
976
977 output, err := runCommand(http, remotes, "master", `123`, baseRepo)
978 assert.NoError(t, err)
979 assert.Equal(t, "", output.String())
980 assert.Equal(t, "", output.Stderr())
981}
982
983func TestPRCheckout_differentRepo(t *testing.T) {
984 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
StringMethod · 0.65
ExpectFieldsMethod · 0.45
RegisterMethod · 0.45

Tested by

no test coverage detected