(t *testing.T)
| 530 | } |
| 531 | |
| 532 | func TestRunViewWeb_TTY(t *testing.T) { |
| 533 | tests := []struct { |
| 534 | name string |
| 535 | setup func(*viewOpts, *testing.T) func() |
| 536 | promptStubs func(*prompter.PrompterMock) |
| 537 | gqlStubs func(*testing.T) |
| 538 | expectedBrowse string |
| 539 | tty bool |
| 540 | }{ |
| 541 | { |
| 542 | name: "Org project --web with tty", |
| 543 | tty: true, |
| 544 | setup: func(vo *viewOpts, t *testing.T) func() { |
| 545 | return func() { |
| 546 | vo.web = true |
| 547 | } |
| 548 | }, |
| 549 | gqlStubs: func(t *testing.T) { |
| 550 | gock.New("https://api.github.com"). |
| 551 | Post("/graphql"). |
| 552 | MatchType("json"). |
| 553 | JSON(map[string]interface{}{ |
| 554 | "query": "query ViewerLoginAndOrgs.*", |
| 555 | "variables": map[string]interface{}{ |
| 556 | "after": nil, |
| 557 | }, |
| 558 | }). |
| 559 | Reply(200). |
| 560 | JSON(map[string]interface{}{ |
| 561 | "data": map[string]interface{}{ |
| 562 | "viewer": map[string]interface{}{ |
| 563 | "id": "monalisa-ID", |
| 564 | "login": "monalisa", |
| 565 | "organizations": map[string]interface{}{ |
| 566 | "nodes": []interface{}{ |
| 567 | map[string]interface{}{ |
| 568 | "login": "github", |
| 569 | "viewerCanCreateProjects": true, |
| 570 | }, |
| 571 | }, |
| 572 | }, |
| 573 | }, |
| 574 | }, |
| 575 | }) |
| 576 | |
| 577 | gock.New("https://api.github.com"). |
| 578 | Post("/graphql"). |
| 579 | MatchType("json"). |
| 580 | JSON(map[string]interface{}{ |
| 581 | "query": "query OrgProjects.*", |
| 582 | "variables": map[string]interface{}{ |
| 583 | "after": nil, |
| 584 | "afterFields": nil, |
| 585 | "afterItems": nil, |
| 586 | "first": 30, |
| 587 | "firstFields": 100, |
| 588 | "firstItems": 0, |
| 589 | "login": "github", |
nothing calls this directly
no test coverage detected