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

Function TestRunCreateItem_Draft_Org

pkg/cmd/project/item-create/item_create_test.go:202–291  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

200}
201
202func TestRunCreateItem_Draft_Org(t *testing.T) {
203 defer gock.Off()
204 gock.Observe(gock.DumpRequest)
205 // get org ID
206 gock.New("https://api.github.com").
207 Post("/graphql").
208 MatchType("json").
209 JSON(map[string]interface{}{
210 "query": "query UserOrgOwner.*",
211 "variables": map[string]interface{}{
212 "login": "github",
213 },
214 }).
215 Reply(200).
216 JSON(map[string]interface{}{
217 "data": map[string]interface{}{
218 "organization": map[string]interface{}{
219 "id": "an ID",
220 },
221 },
222 "errors": []interface{}{
223 map[string]interface{}{
224 "type": "NOT_FOUND",
225 "path": []string{"user"},
226 },
227 },
228 })
229
230 // get project ID
231 gock.New("https://api.github.com").
232 Post("/graphql").
233 MatchType("json").
234 JSON(map[string]interface{}{
235 "query": "query OrgProject.*",
236 "variables": map[string]interface{}{
237 "login": "github",
238 "number": 1,
239 "firstItems": 0,
240 "afterItems": nil,
241 "firstFields": 0,
242 "afterFields": nil,
243 },
244 }).
245 Reply(200).
246 JSON(map[string]interface{}{
247 "data": map[string]interface{}{
248 "organization": map[string]interface{}{
249 "projectV2": map[string]interface{}{
250 "id": "an ID",
251 },
252 },
253 },
254 })
255
256 // create item
257 gock.New("https://api.github.com").
258 Post("/graphql").
259 BodyString(`{"query":"mutation CreateDraftItem.*","variables":{"input":{"projectId":"an ID","title":"a title","body":""}}}`).

Callers

nothing calls this directly

Calls 7

NewTestClientFunction · 0.92
TestFunction · 0.92
runCreateItemFunction · 0.85
ReplyMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected