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

Function TestMergeRun_disableAutoMerge

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

Source from the content-addressed store, hash-verified

1820}
1821
1822func TestMergeRun_disableAutoMerge(t *testing.T) {
1823 ios, _, stdout, stderr := iostreams.Test()
1824 ios.SetStdoutTTY(true)
1825 ios.SetStderrTTY(true)
1826
1827 tr := initFakeHTTP()
1828 defer tr.Verify(t)
1829 tr.Register(
1830 httpmock.GraphQL(`mutation PullRequestAutoMergeDisable\b`),
1831 httpmock.GraphQLQuery(`{}`, func(s string, m map[string]any) {
1832 assert.Equal(t, map[string]any{"prID": "THE-ID"}, m)
1833 }))
1834
1835 _, cmdTeardown := run.Stub()
1836 defer cmdTeardown(t)
1837
1838 err := mergeRun(&MergeOptions{
1839 IO: ios,
1840 HttpClient: func() (*http.Client, error) {
1841 return &http.Client{Transport: tr}, nil
1842 },
1843 SelectorArg: "https://github.com/OWNER/REPO/pull/123",
1844 AutoMergeDisable: true,
1845 Finder: shared.NewMockFinder(
1846 "https://github.com/OWNER/REPO/pull/123",
1847 &api.PullRequest{ID: "THE-ID", Number: 123},
1848 ghrepo.New("OWNER", "REPO"),
1849 ),
1850 })
1851 assert.NoError(t, err)
1852
1853 assert.Equal(t, "", stdout.String())
1854 assert.Equal(t, "✓ Auto-merge disabled for pull request OWNER/REPO#123\n", stderr.String())
1855}
1856
1857func TestPrInMergeQueue(t *testing.T) {
1858 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