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

Function Test_RepoMetadata

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

Source from the content-addressed store, hash-verified

287}
288
289func Test_RepoMetadata(t *testing.T) {
290 http := &httpmock.Registry{}
291 client := newTestClient(http)
292
293 repo, _ := ghrepo.FromFullName("OWNER/REPO")
294 input := RepoMetadataInput{
295 Assignees: true,
296 Reviewers: true,
297 TeamReviewers: true,
298 Labels: true,
299 ProjectsV1: true,
300 ProjectsV2: true,
301 Milestones: true,
302 }
303
304 http.Register(
305 httpmock.GraphQL(`query RepositoryAssignableUsers\b`),
306 httpmock.StringResponse(`
307 { "data": { "repository": { "assignableUsers": {
308 "nodes": [
309 { "login": "hubot", "id": "HUBOTID" },
310 { "login": "MonaLisa", "id": "MONAID" }
311 ],
312 "pageInfo": { "hasNextPage": false }
313 } } } }
314 `))
315 http.Register(
316 httpmock.GraphQL(`query RepositoryLabelList\b`),
317 httpmock.StringResponse(`
318 { "data": { "repository": { "labels": {
319 "nodes": [
320 { "name": "feature", "id": "FEATUREID" },
321 { "name": "TODO", "id": "TODOID" },
322 { "name": "bug", "id": "BUGID" }
323 ],
324 "pageInfo": { "hasNextPage": false }
325 } } } }
326 `))
327 http.Register(
328 httpmock.GraphQL(`query RepositoryMilestoneList\b`),
329 httpmock.StringResponse(`
330 { "data": { "repository": { "milestones": {
331 "nodes": [
332 { "title": "GA", "id": "GAID" },
333 { "title": "Big One.oh", "id": "BIGONEID" }
334 ],
335 "pageInfo": { "hasNextPage": false }
336 } } } }
337 `))
338 http.Register(
339 httpmock.GraphQL(`query RepositoryProjectList\b`),
340 httpmock.StringResponse(`
341 { "data": { "repository": { "projects": {
342 "nodes": [
343 { "name": "Cleanup", "id": "CLEANUPID" },
344 { "name": "Roadmap", "id": "ROADMAPID" }
345 ],
346 "pageInfo": { "hasNextPage": false }

Callers

nothing calls this directly

Calls 13

RegisterMethod · 0.95
FromFullNameFunction · 0.92
GraphQLFunction · 0.92
StringResponseFunction · 0.92
newTestClientFunction · 0.85
RepoMetadataFunction · 0.85
MembersToIDsMethod · 0.80
EqualMethod · 0.80
TeamsToIDsMethod · 0.80
LabelsToIDsMethod · 0.80
ProjectsTitlesToIDsMethod · 0.80
MilestoneToIDMethod · 0.80

Tested by

no test coverage detected