| 377 | } |
| 378 | |
| 379 | func TestRunViewWeb_Org(t *testing.T) { |
| 380 | defer gock.Off() |
| 381 | gock.Observe(gock.DumpRequest) |
| 382 | // get org ID |
| 383 | gock.New("https://api.github.com"). |
| 384 | Post("/graphql"). |
| 385 | MatchType("json"). |
| 386 | JSON(map[string]interface{}{ |
| 387 | "query": "query UserOrgOwner.*", |
| 388 | "variables": map[string]interface{}{ |
| 389 | "login": "github", |
| 390 | }, |
| 391 | }). |
| 392 | Reply(200). |
| 393 | JSON(map[string]interface{}{ |
| 394 | "data": map[string]interface{}{ |
| 395 | "organization": map[string]interface{}{ |
| 396 | "id": "an ID", |
| 397 | }, |
| 398 | }, |
| 399 | "errors": []interface{}{ |
| 400 | map[string]interface{}{ |
| 401 | "type": "NOT_FOUND", |
| 402 | "path": []string{"user"}, |
| 403 | }, |
| 404 | }, |
| 405 | }) |
| 406 | |
| 407 | gock.New("https://api.github.com"). |
| 408 | Post("/graphql"). |
| 409 | Reply(200). |
| 410 | JSON(` |
| 411 | {"data": |
| 412 | {"organization": |
| 413 | { |
| 414 | "login":"github", |
| 415 | "projectV2": { |
| 416 | "number": 8, |
| 417 | "items": { |
| 418 | "totalCount": 10 |
| 419 | }, |
| 420 | "url": "https://github.com/orgs/github/projects/8", |
| 421 | "readme": null, |
| 422 | "fields": { |
| 423 | "nodes": [ |
| 424 | { |
| 425 | "name": "Title" |
| 426 | } |
| 427 | ] |
| 428 | } |
| 429 | } |
| 430 | } |
| 431 | } |
| 432 | } |
| 433 | `) |
| 434 | |
| 435 | client := queries.NewTestClient() |
| 436 | buf := bytes.Buffer{} |