MCPcopy
hub / github.com/cli/cli / TestRunCreateField_Me

Function TestRunCreateField_Me

pkg/cmd/project/field-create/field_create_test.go:305–385  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

303}
304
305func TestRunCreateField_Me(t *testing.T) {
306 defer gock.Off()
307 gock.Observe(gock.DumpRequest)
308 // get viewer ID
309 gock.New("https://api.github.com").
310 Post("/graphql").
311 MatchType("json").
312 JSON(map[string]interface{}{
313 "query": "query ViewerOwner.*",
314 }).
315 Reply(200).
316 JSON(map[string]interface{}{
317 "data": map[string]interface{}{
318 "viewer": map[string]interface{}{
319 "id": "an ID",
320 },
321 },
322 })
323
324 // get project ID
325 gock.New("https://api.github.com").
326 Post("/graphql").
327 MatchType("json").
328 JSON(map[string]interface{}{
329 "query": "query ViewerProject.*",
330 "variables": map[string]interface{}{
331 "number": 1,
332 "firstItems": 0,
333 "afterItems": nil,
334 "firstFields": 0,
335 "afterFields": nil,
336 },
337 }).
338 Reply(200).
339 JSON(map[string]interface{}{
340 "data": map[string]interface{}{
341 "viewer": map[string]interface{}{
342 "projectV2": map[string]interface{}{
343 "id": "an ID",
344 },
345 },
346 },
347 })
348
349 // create Field
350 gock.New("https://api.github.com").
351 Post("/graphql").
352 BodyString(`{"query":"mutation CreateField.*","variables":{"input":{"projectId":"an ID","dataType":"TEXT","name":"a name"}}}`).
353 Reply(200).
354 JSON(map[string]interface{}{
355 "data": map[string]interface{}{
356 "createProjectV2Field": map[string]interface{}{
357 "projectV2Field": map[string]interface{}{
358 "id": "Field ID",
359 },
360 },
361 },
362 })

Callers

nothing calls this directly

Calls 7

NewTestClientFunction · 0.92
TestFunction · 0.92
runCreateFieldFunction · 0.85
ReplyMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected