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

Function Test_RepoMetadata

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

Source from the content-addressed store, hash-verified

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