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

Function TestMergeRun_disableAutoMerge

pkg/cmd/pr/merge/merge_test.go:1741–1774  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1739}
1740
1741func TestMergeRun_disableAutoMerge(t *testing.T) {
1742 ios, _, stdout, stderr := iostreams.Test()
1743 ios.SetStdoutTTY(true)
1744 ios.SetStderrTTY(true)
1745
1746 tr := initFakeHTTP()
1747 defer tr.Verify(t)
1748 tr.Register(
1749 httpmock.GraphQL(`mutation PullRequestAutoMergeDisable\b`),
1750 httpmock.GraphQLQuery(`{}`, func(s string, m map[string]interface{}) {
1751 assert.Equal(t, map[string]interface{}{"prID": "THE-ID"}, m)
1752 }))
1753
1754 _, cmdTeardown := run.Stub()
1755 defer cmdTeardown(t)
1756
1757 err := mergeRun(&MergeOptions{
1758 IO: ios,
1759 HttpClient: func() (*http.Client, error) {
1760 return &http.Client{Transport: tr}, nil
1761 },
1762 SelectorArg: "https://github.com/OWNER/REPO/pull/123",
1763 AutoMergeDisable: true,
1764 Finder: shared.NewMockFinder(
1765 "https://github.com/OWNER/REPO/pull/123",
1766 &api.PullRequest{ID: "THE-ID", Number: 123},
1767 ghrepo.New("OWNER", "REPO"),
1768 ),
1769 })
1770 assert.NoError(t, err)
1771
1772 assert.Equal(t, "", stdout.String())
1773 assert.Equal(t, "✓ Auto-merge disabled for pull request OWNER/REPO#123\n", stderr.String())
1774}
1775
1776func TestPrInMergeQueue(t *testing.T) {
1777 http := initFakeHTTP()

Callers

nothing calls this directly

Calls 14

TestFunction · 0.92
GraphQLFunction · 0.92
GraphQLQueryFunction · 0.92
StubFunction · 0.92
NewMockFinderFunction · 0.92
NewFunction · 0.92
mergeRunFunction · 0.85
SetStdoutTTYMethod · 0.80
SetStderrTTYMethod · 0.80
EqualMethod · 0.80
initFakeHTTPFunction · 0.70
VerifyMethod · 0.65

Tested by

no test coverage detected