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

Function TestPRCheckout_differentRepo

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

Source from the content-addressed store, hash-verified

979}
980
981func TestPRCheckout_differentRepo(t *testing.T) {
982 http := &httpmock.Registry{}
983 defer http.Verify(t)
984
985 baseRepo, pr := stubPR("OWNER/REPO:master", "hubot/REPO:feature")
986 finder := shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)
987 finder.ExpectFields([]string{"number", "headRefName", "headRepository", "headRepositoryOwner", "isCrossRepository", "maintainerCanModify"})
988
989 cs, cmdTeardown := run.Stub()
990 defer cmdTeardown(t)
991 cs.Register(`git fetch origin refs/pull/123/head:feature --no-tags`, 0, "")
992 cs.Register(`git config branch\.feature\.merge`, 1, "")
993 cs.Register(`git checkout feature`, 0, "")
994 cs.Register(`git config branch\.feature\.remote origin`, 0, "")
995 cs.Register(`git config branch\.feature\.pushRemote origin`, 0, "")
996 cs.Register(`git config branch\.feature\.merge refs/pull/123/head`, 0, "")
997
998 output, err := runCommand(http, nil, "master", `123`, baseRepo)
999 assert.NoError(t, err)
1000 assert.Equal(t, "", output.String())
1001 assert.Equal(t, "", output.Stderr())
1002}
1003
1004func TestPRCheckout_differentRepoForce(t *testing.T) {
1005 http := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 10

VerifyMethod · 0.95
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