(t *testing.T)
| 230 | } |
| 231 | |
| 232 | func TestRunUpdate_Org(t *testing.T) { |
| 233 | defer gock.Off() |
| 234 | gock.Observe(gock.DumpRequest) |
| 235 | // get org ID |
| 236 | gock.New("https://api.github.com"). |
| 237 | Post("/graphql"). |
| 238 | MatchType("json"). |
| 239 | JSON(map[string]interface{}{ |
| 240 | "query": "query UserOrgOwner.*", |
| 241 | "variables": map[string]interface{}{ |
| 242 | "login": "github", |
| 243 | }, |
| 244 | }). |
| 245 | Reply(200). |
| 246 | JSON(map[string]interface{}{ |
| 247 | "data": map[string]interface{}{ |
| 248 | "organization": map[string]interface{}{ |
| 249 | "id": "an ID", |
| 250 | }, |
| 251 | }, |
| 252 | "errors": []interface{}{ |
| 253 | map[string]interface{}{ |
| 254 | "type": "NOT_FOUND", |
| 255 | "path": []string{"user"}, |
| 256 | }, |
| 257 | }, |
| 258 | }) |
| 259 | |
| 260 | // get org project ID |
| 261 | gock.New("https://api.github.com"). |
| 262 | Post("/graphql"). |
| 263 | MatchType("json"). |
| 264 | JSON(map[string]interface{}{ |
| 265 | "query": "query OrgProject.*", |
| 266 | "variables": map[string]interface{}{ |
| 267 | "login": "github", |
| 268 | "number": 1, |
| 269 | "firstItems": 0, |
| 270 | "afterItems": nil, |
| 271 | "firstFields": 0, |
| 272 | "afterFields": nil, |
| 273 | }, |
| 274 | }). |
| 275 | Reply(200). |
| 276 | JSON(map[string]interface{}{ |
| 277 | "data": map[string]interface{}{ |
| 278 | "organization": map[string]interface{}{ |
| 279 | "projectV2": map[string]string{ |
| 280 | "id": "an ID", |
| 281 | }, |
| 282 | }, |
| 283 | }, |
| 284 | }) |
| 285 | |
| 286 | // edit project |
| 287 | gock.New("https://api.github.com"). |
| 288 | Post("/graphql"). |
| 289 | BodyString(`{"query":"mutation UpdateProjectV2.*"variables":{"afterFields":null,"afterItems":null,"firstFields":0,"firstItems":0,"input":{"projectId":"an ID","title":"a new title","shortDescription":"a new description","readme":"a new readme","public":true}}}`). |
nothing calls this directly
no test coverage detected