(t *testing.T)
| 328 | } |
| 329 | |
| 330 | func 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 | }, |
nothing calls this directly
no test coverage detected