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

Function TestPRCheckout_differentRepo_remoteExists

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

Source from the content-addressed store, hash-verified

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