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

Function TestIssueRepoInfo_success

api/queries_repo_test.go:243–270  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

241}
242
243func TestIssueRepoInfo_success(t *testing.T) {
244 httpReg := &httpmock.Registry{}
245 defer httpReg.Verify(t)
246
247 httpReg.Register(
248 httpmock.GraphQL(`query IssueRepositoryInfo\b`),
249 httpmock.StringResponse(`
250 { "data": { "repository": {
251 "id": "REPOID",
252 "name": "REPO",
253 "owner": {"login": "OWNER"},
254 "hasIssuesEnabled": true,
255 "viewerPermission": "WRITE"
256 } } }`))
257
258 client := newTestClient(httpReg)
259 repo, err := IssueRepoInfo(client, ghrepo.New("OWNER", "REPO"))
260 require.NoError(t, err)
261 assert.Equal(t, &Repository{
262 ID: "REPOID",
263 Name: "REPO",
264 Owner: RepositoryOwner{Login: "OWNER"},
265 HasIssuesEnabled: true,
266 ViewerPermission: "WRITE",
267 hostname: "github.com",
268 }, repo)
269 assert.True(t, repo.ViewerCanTriage())
270}
271
272func TestIssueRepoInfo_issuesDisabled(t *testing.T) {
273 httpReg := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 9

VerifyMethod · 0.95
RegisterMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
NewFunction · 0.92
newTestClientFunction · 0.85
IssueRepoInfoFunction · 0.85
EqualMethod · 0.80
ViewerCanTriageMethod · 0.80

Tested by

no test coverage detected