(t *testing.T)
| 80 | } |
| 81 | |
| 82 | func TestRunCreate_User(t *testing.T) { |
| 83 | defer gock.Off() |
| 84 | gock.Observe(gock.DumpRequest) |
| 85 | |
| 86 | // get user ID |
| 87 | gock.New("https://api.github.com"). |
| 88 | Post("/graphql"). |
| 89 | MatchType("json"). |
| 90 | JSON(map[string]interface{}{ |
| 91 | "query": "query UserOrgOwner.*", |
| 92 | "variables": map[string]string{ |
| 93 | "login": "monalisa", |
| 94 | }, |
| 95 | }). |
| 96 | Reply(200). |
| 97 | JSON(map[string]interface{}{ |
| 98 | "data": map[string]interface{}{ |
| 99 | "user": map[string]interface{}{ |
| 100 | "id": "an ID", |
| 101 | "login": "monalisa", |
| 102 | }, |
| 103 | }, |
| 104 | "errors": []interface{}{ |
| 105 | map[string]interface{}{ |
| 106 | "type": "NOT_FOUND", |
| 107 | "path": []string{"organization"}, |
| 108 | }, |
| 109 | }, |
| 110 | }) |
| 111 | |
| 112 | // create project |
| 113 | gock.New("https://api.github.com"). |
| 114 | Post("/graphql"). |
| 115 | BodyString(`{"query":"mutation CreateProjectV2.*"variables":{"afterFields":null,"afterItems":null,"firstFields":0,"firstItems":0,"input":{"ownerId":"an ID","title":"a title"}}}`). |
| 116 | Reply(200). |
| 117 | JSON(map[string]interface{}{ |
| 118 | "data": map[string]interface{}{ |
| 119 | "createProjectV2": map[string]interface{}{ |
| 120 | "projectV2": map[string]interface{}{ |
| 121 | "title": "a title", |
| 122 | "url": "http://a-url.com", |
| 123 | "owner": map[string]string{ |
| 124 | "login": "monalisa", |
| 125 | }, |
| 126 | }, |
| 127 | }, |
| 128 | }, |
| 129 | }) |
| 130 | |
| 131 | client := queries.NewTestClient() |
| 132 | |
| 133 | ios, _, stdout, _ := iostreams.Test() |
| 134 | ios.SetStdoutTTY(true) |
| 135 | config := createConfig{ |
| 136 | opts: createOpts{ |
| 137 | title: "a title", |
| 138 | owner: "monalisa", |
| 139 | }, |
nothing calls this directly
no test coverage detected