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

Function mockIssueGetWithRepository

pkg/cmd/issue/edit/edit_test.go:1843–1855  ·  view source on GitHub ↗

mockIssueGetWithRepository stubs the issue lookup with a body and the two repository fields the uploader reads. A row states both, so an empty permission is a value a row can ask for.

(reg *httpmock.Registry, body string, databaseID int64, viewerPermission string)

Source from the content-addressed store, hash-verified

1841// repository fields the uploader reads. A row states both, so an empty
1842// permission is a value a row can ask for.
1843func mockIssueGetWithRepository(reg *httpmock.Registry, body string, databaseID int64, viewerPermission string) {
1844 reg.Register(
1845 httpmock.GraphQL(`query IssueByNumber\b`),
1846 httpmock.StringResponse(fmt.Sprintf(`
1847 { "data": { "repository": { "hasIssuesEnabled": true, "issue": {
1848 "id": "123",
1849 "number": 123,
1850 "url": "https://github.com/OWNER/REPO/issue/123",
1851 "body": %s,
1852 "repository": { "databaseId": %d, "viewerPermission": %s }
1853 } } } }`, strconv.Quote(body), databaseID, strconv.Quote(viewerPermission))),
1854 )
1855}
1856
1857func mockIssueNumberGet(_ *testing.T, reg *httpmock.Registry, number int) {
1858 reg.Register(

Callers 1

Test_editRunFunction · 0.85

Calls 3

GraphQLFunction · 0.92
StringResponseFunction · 0.92
RegisterMethod · 0.45

Tested by

no test coverage detected