| 330 | } |
| 331 | |
| 332 | func TestRunList_Me(t *testing.T) { |
| 333 | defer gock.Off() |
| 334 | gock.Observe(gock.DumpRequest) |
| 335 | |
| 336 | // get viewer ID |
| 337 | gock.New("https://api.github.com"). |
| 338 | Post("/graphql"). |
| 339 | MatchType("json"). |
| 340 | JSON(map[string]interface{}{ |
| 341 | "query": "query ViewerOwner.*", |
| 342 | }). |
| 343 | Reply(200). |
| 344 | JSON(map[string]interface{}{ |
| 345 | "data": map[string]interface{}{ |
| 346 | "viewer": map[string]interface{}{ |
| 347 | "id": "an ID", |
| 348 | }, |
| 349 | }, |
| 350 | }) |
| 351 | |
| 352 | gock.New("https://api.github.com"). |
| 353 | Post("/graphql"). |
| 354 | Reply(200). |
| 355 | JSON(map[string]interface{}{ |
| 356 | "data": map[string]interface{}{ |
| 357 | "viewer": map[string]interface{}{ |
| 358 | "login": "monalisa", |
| 359 | "projectsV2": map[string]interface{}{ |
| 360 | "nodes": []interface{}{ |
| 361 | map[string]interface{}{ |
| 362 | "title": "Project 1", |
| 363 | "shortDescription": "Short description 1", |
| 364 | "url": "url1", |
| 365 | "closed": false, |
| 366 | "ID": "id-1", |
| 367 | "number": 1, |
| 368 | }, |
| 369 | map[string]interface{}{ |
| 370 | "title": "Project 2", |
| 371 | "shortDescription": "", |
| 372 | "url": "url2", |
| 373 | "closed": true, |
| 374 | "ID": "id-2", |
| 375 | "number": 2, |
| 376 | }, |
| 377 | }, |
| 378 | }, |
| 379 | }, |
| 380 | }, |
| 381 | }) |
| 382 | |
| 383 | client := queries.NewTestClient() |
| 384 | |
| 385 | ios, _, stdout, _ := iostreams.Test() |
| 386 | config := listConfig{ |
| 387 | opts: listOpts{ |
| 388 | owner: "@me", |
| 389 | }, |