(t *testing.T)
| 164 | } |
| 165 | |
| 166 | func TestRunView_Viewer(t *testing.T) { |
| 167 | defer gock.Off() |
| 168 | |
| 169 | // get viewer ID |
| 170 | gock.New("https://api.github.com"). |
| 171 | Post("/graphql"). |
| 172 | MatchType("json"). |
| 173 | JSON(map[string]interface{}{ |
| 174 | "query": "query ViewerOwner.*", |
| 175 | }). |
| 176 | Reply(200). |
| 177 | JSON(map[string]interface{}{ |
| 178 | "data": map[string]interface{}{ |
| 179 | "viewer": map[string]interface{}{ |
| 180 | "id": "an ID", |
| 181 | }, |
| 182 | }, |
| 183 | }) |
| 184 | |
| 185 | gock.New("https://api.github.com"). |
| 186 | Post("/graphql"). |
| 187 | Reply(200). |
| 188 | JSON(` |
| 189 | {"data": |
| 190 | {"viewer": |
| 191 | { |
| 192 | "login":"monalisa", |
| 193 | "projectV2": { |
| 194 | "number": 1, |
| 195 | "items": { |
| 196 | "totalCount": 10 |
| 197 | }, |
| 198 | "url":"https://github.com/orgs/github/projects/8", |
| 199 | "readme": null, |
| 200 | "fields": { |
| 201 | "nodes": [ |
| 202 | { |
| 203 | "name": "Title" |
| 204 | } |
| 205 | ] |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | } |
| 211 | `) |
| 212 | |
| 213 | client := queries.NewTestClient() |
| 214 | |
| 215 | ios, _, _, _ := iostreams.Test() |
| 216 | config := viewConfig{ |
| 217 | opts: viewOpts{ |
| 218 | owner: "@me", |
| 219 | number: 1, |
| 220 | }, |
| 221 | io: ios, |
| 222 | client: client, |
| 223 | } |
nothing calls this directly
no test coverage detected