(t *testing.T)
| 210 | } |
| 211 | |
| 212 | func TestRunCreateField_Org(t *testing.T) { |
| 213 | defer gock.Off() |
| 214 | gock.Observe(gock.DumpRequest) |
| 215 | |
| 216 | // get org ID |
| 217 | gock.New("https://api.github.com"). |
| 218 | Post("/graphql"). |
| 219 | MatchType("json"). |
| 220 | JSON(map[string]interface{}{ |
| 221 | "query": "query UserOrgOwner.*", |
| 222 | "variables": map[string]interface{}{ |
| 223 | "login": "github", |
| 224 | }, |
| 225 | }). |
| 226 | Reply(200). |
| 227 | JSON(map[string]interface{}{ |
| 228 | "data": map[string]interface{}{ |
| 229 | "organization": map[string]interface{}{ |
| 230 | "id": "an ID", |
| 231 | }, |
| 232 | }, |
| 233 | "errors": []interface{}{ |
| 234 | map[string]interface{}{ |
| 235 | "type": "NOT_FOUND", |
| 236 | "path": []string{"user"}, |
| 237 | }, |
| 238 | }, |
| 239 | }) |
| 240 | |
| 241 | // get project ID |
| 242 | gock.New("https://api.github.com"). |
| 243 | Post("/graphql"). |
| 244 | MatchType("json"). |
| 245 | JSON(map[string]interface{}{ |
| 246 | "query": "query OrgProject.*", |
| 247 | "variables": map[string]interface{}{ |
| 248 | "login": "github", |
| 249 | "number": 1, |
| 250 | "firstItems": 0, |
| 251 | "afterItems": nil, |
| 252 | "firstFields": 0, |
| 253 | "afterFields": nil, |
| 254 | }, |
| 255 | }). |
| 256 | Reply(200). |
| 257 | JSON(map[string]interface{}{ |
| 258 | "data": map[string]interface{}{ |
| 259 | "organization": map[string]interface{}{ |
| 260 | "projectV2": map[string]interface{}{ |
| 261 | "id": "an ID", |
| 262 | }, |
| 263 | }, |
| 264 | }, |
| 265 | }) |
| 266 | |
| 267 | // create Field |
| 268 | gock.New("https://api.github.com"). |
| 269 | Post("/graphql"). |
nothing calls this directly
no test coverage detected