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

Function mockRepoMetadata

pkg/cmd/pr/edit/edit_test.go:1737–1854  ·  view source on GitHub ↗
(reg *httpmock.Registry, opt mockRepoMetadataOptions)

Source from the content-addressed store, hash-verified

1735}
1736
1737func mockRepoMetadata(reg *httpmock.Registry, opt mockRepoMetadataOptions) {
1738 // Assignable actors (users/bots) are fetched when reviewers OR assignees edited with ApiActorsSupported enabled.
1739 if opt.reviewers || opt.assignees {
1740 reg.Register(
1741 httpmock.GraphQL(`query RepositoryAssignableActors\b`),
1742 httpmock.StringResponse(`
1743 { "data": { "repository": { "suggestedActors": {
1744 "nodes": [
1745 { "login": "hubot", "id": "HUBOTID", "__typename": "Bot" },
1746 { "login": "monalisa", "id": "MONAID", "name": "Mona Display Name", "__typename": "User" }
1747 ],
1748 "pageInfo": { "hasNextPage": false }
1749 } } } }
1750 `))
1751 }
1752 if opt.labels {
1753 reg.Register(
1754 httpmock.GraphQL(`query RepositoryLabelList\b`),
1755 httpmock.StringResponse(`
1756 { "data": { "repository": { "labels": {
1757 "nodes": [
1758 { "name": "feature", "id": "FEATUREID" },
1759 { "name": "TODO", "id": "TODOID" },
1760 { "name": "bug", "id": "BUGID" },
1761 { "name": "docs", "id": "DOCSID" }
1762 ],
1763 "pageInfo": { "hasNextPage": false }
1764 } } } }
1765 `))
1766 }
1767 if opt.milestones {
1768 reg.Register(
1769 httpmock.GraphQL(`query RepositoryMilestoneList\b`),
1770 httpmock.StringResponse(`
1771 { "data": { "repository": { "milestones": {
1772 "nodes": [
1773 { "title": "GA", "id": "GAID" },
1774 { "title": "Big One.oh", "id": "BIGONEID" }
1775 ],
1776 "pageInfo": { "hasNextPage": false }
1777 } } } }
1778 `))
1779 }
1780 if opt.projects {
1781 reg.Register(
1782 httpmock.GraphQL(`query RepositoryProjectList\b`),
1783 httpmock.StringResponse(`
1784 { "data": { "repository": { "projects": {
1785 "nodes": [
1786 { "name": "Cleanup", "id": "CLEANUPID" },
1787 { "name": "Roadmap", "id": "ROADMAPID" }
1788 ],
1789 "pageInfo": { "hasNextPage": false }
1790 } } } }
1791 `))
1792 reg.Register(
1793 httpmock.GraphQL(`query OrganizationProjectList\b`),
1794 httpmock.StringResponse(`

Callers 1

Test_editRunFunction · 0.70

Calls 3

GraphQLFunction · 0.92
StringResponseFunction · 0.92
RegisterMethod · 0.45

Tested by

no test coverage detected