MCPcopy
hub / github.com/cli/cli / TestIssueRepoInfo_success

Function TestIssueRepoInfo_success

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

Source from the content-addressed store, hash-verified

147}
148
149func TestIssueRepoInfo_success(t *testing.T) {
150 httpReg := &httpmock.Registry{}
151 defer httpReg.Verify(t)
152
153 httpReg.Register(
154 httpmock.GraphQL(`query IssueRepositoryInfo\b`),
155 httpmock.StringResponse(`
156 { "data": { "repository": {
157 "id": "REPOID",
158 "name": "REPO",
159 "owner": {"login": "OWNER"},
160 "hasIssuesEnabled": true,
161 "viewerPermission": "WRITE"
162 } } }`))
163
164 client := newTestClient(httpReg)
165 repo, err := IssueRepoInfo(client, ghrepo.New("OWNER", "REPO"))
166 require.NoError(t, err)
167 assert.Equal(t, &Repository{
168 ID: "REPOID",
169 Name: "REPO",
170 Owner: RepositoryOwner{Login: "OWNER"},
171 HasIssuesEnabled: true,
172 ViewerPermission: "WRITE",
173 hostname: "github.com",
174 }, repo)
175 assert.True(t, repo.ViewerCanTriage())
176}
177
178func TestIssueRepoInfo_issuesDisabled(t *testing.T) {
179 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