| 276 | } |
| 277 | |
| 278 | func TestRunList_Org(t *testing.T) { |
| 279 | defer gock.Off() |
| 280 | // gock.Observe(gock.DumpRequest) |
| 281 | |
| 282 | // get org ID |
| 283 | gock.New("https://api.github.com"). |
| 284 | Post("/graphql"). |
| 285 | MatchType("json"). |
| 286 | JSON(map[string]interface{}{ |
| 287 | "query": "query UserOrgOwner.*", |
| 288 | "variables": map[string]interface{}{ |
| 289 | "login": "github", |
| 290 | }, |
| 291 | }). |
| 292 | Reply(200). |
| 293 | JSON(map[string]interface{}{ |
| 294 | "data": map[string]interface{}{ |
| 295 | "organization": map[string]interface{}{ |
| 296 | "id": "an ID", |
| 297 | }, |
| 298 | }, |
| 299 | "errors": []interface{}{ |
| 300 | map[string]interface{}{ |
| 301 | "type": "NOT_FOUND", |
| 302 | "path": []string{"user"}, |
| 303 | }, |
| 304 | }, |
| 305 | }) |
| 306 | |
| 307 | // list project fields |
| 308 | gock.New("https://api.github.com"). |
| 309 | Post("/graphql"). |
| 310 | JSON(map[string]interface{}{ |
| 311 | "query": "query OrgProject.*", |
| 312 | "variables": map[string]interface{}{ |
| 313 | "login": "github", |
| 314 | "number": 1, |
| 315 | "firstItems": queries.LimitMax, |
| 316 | "afterItems": nil, |
| 317 | "firstFields": queries.LimitDefault, |
| 318 | "afterFields": nil, |
| 319 | }, |
| 320 | }). |
| 321 | Reply(200). |
| 322 | JSON(map[string]interface{}{ |
| 323 | "data": map[string]interface{}{ |
| 324 | "organization": map[string]interface{}{ |
| 325 | "projectV2": map[string]interface{}{ |
| 326 | "fields": map[string]interface{}{ |
| 327 | "nodes": []map[string]interface{}{ |
| 328 | { |
| 329 | "__typename": "ProjectV2Field", |
| 330 | "name": "FieldTitle", |
| 331 | "id": "field ID", |
| 332 | }, |
| 333 | { |
| 334 | "__typename": "ProjectV2SingleSelectField", |
| 335 | "name": "Status", |