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

Function setupRunAddItemUserMocks

pkg/cmd/project/item-add/item_add_test.go:104–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102}
103
104func setupRunAddItemUserMocks() {
105 // get user ID
106 gock.New("https://api.github.com").
107 Post("/graphql").
108 MatchType("json").
109 JSON(map[string]any{
110 "query": "query UserOrgOwner.*",
111 "variables": map[string]any{
112 "login": "monalisa",
113 },
114 }).
115 Reply(200).
116 JSON(map[string]any{
117 "data": map[string]any{
118 "user": map[string]any{
119 "id": "an ID",
120 },
121 },
122 "errors": []any{
123 map[string]any{
124 "type": "NOT_FOUND",
125 "path": []string{"organization"},
126 },
127 },
128 })
129
130 // get project ID
131 gock.New("https://api.github.com").
132 Post("/graphql").
133 MatchType("json").
134 JSON(map[string]any{
135 "query": "query UserProject.*",
136 "variables": map[string]any{
137 "login": "monalisa",
138 "number": 1,
139 "firstItems": 0,
140 "afterItems": nil,
141 "firstFields": 0,
142 "afterFields": nil,
143 },
144 }).
145 Reply(200).
146 JSON(map[string]any{
147 "data": map[string]any{
148 "user": map[string]any{
149 "projectV2": map[string]any{
150 "id": "an ID",
151 },
152 },
153 },
154 })
155
156 // get item ID
157 gock.New("https://api.github.com").
158 Post("/graphql").
159 MatchType("json").
160 JSON(map[string]any{
161 "query": "query GetIssueOrPullRequest.*",

Callers 1

TestRunAddItem_UserFunction · 0.85

Calls 1

ReplyMethod · 0.80

Tested by

no test coverage detected