MCPcopy Index your code
hub / github.com/cli/cli / TestRunUpdate_Me

Function TestRunUpdate_Me

pkg/cmd/project/edit/edit_test.go:330–416  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

328}
329
330func TestRunUpdate_Me(t *testing.T) {
331 defer gock.Off()
332 // get viewer ID
333 gock.New("https://api.github.com").
334 Post("/graphql").
335 MatchType("json").
336 JSON(map[string]interface{}{
337 "query": "query ViewerOwner.*",
338 }).
339 Reply(200).
340 JSON(map[string]interface{}{
341 "data": map[string]interface{}{
342 "viewer": map[string]interface{}{
343 "id": "an ID",
344 },
345 },
346 })
347
348 gock.Observe(gock.DumpRequest)
349 // get viewer project ID
350 gock.New("https://api.github.com").
351 Post("/graphql").
352 MatchType("json").
353 JSON(map[string]interface{}{
354 "query": "query ViewerProject.*",
355 "variables": map[string]interface{}{
356 "number": 1,
357 "firstItems": 0,
358 "afterItems": nil,
359 "firstFields": 0,
360 "afterFields": nil,
361 },
362 }).
363 Reply(200).
364 JSON(map[string]interface{}{
365 "data": map[string]interface{}{
366 "viewer": map[string]interface{}{
367 "projectV2": map[string]string{
368 "id": "an ID",
369 },
370 },
371 },
372 })
373
374 // edit project
375 gock.New("https://api.github.com").
376 Post("/graphql").
377 BodyString(`{"query":"mutation UpdateProjectV2.*"variables":{"afterFields":null,"afterItems":null,"firstFields":0,"firstItems":0,"input":{"projectId":"an ID","title":"a new title","shortDescription":"a new description","readme":"a new readme","public":false}}}`).
378 Reply(200).
379 JSON(map[string]interface{}{
380 "data": map[string]interface{}{
381 "updateProjectV2": map[string]interface{}{
382 "projectV2": map[string]interface{}{
383 "title": "a title",
384 "url": "http://a-url.com",
385 "owner": map[string]string{
386 "login": "me",
387 },

Callers

nothing calls this directly

Calls 7

NewTestClientFunction · 0.92
TestFunction · 0.92
ReplyMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
runEditFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected