(t *testing.T)
| 184 | } |
| 185 | |
| 186 | func TestRunUnlink_Repo(t *testing.T) { |
| 187 | defer gock.Off() |
| 188 | gock.Observe(gock.DumpRequest) |
| 189 | |
| 190 | // get user ID |
| 191 | gock.New("https://api.github.com"). |
| 192 | Post("/graphql"). |
| 193 | MatchType("json"). |
| 194 | JSON(map[string]interface{}{ |
| 195 | "query": "query UserOrgOwner.*", |
| 196 | "variables": map[string]string{ |
| 197 | "login": "monalisa", |
| 198 | }, |
| 199 | }). |
| 200 | Reply(200). |
| 201 | JSON(map[string]interface{}{ |
| 202 | "data": map[string]interface{}{ |
| 203 | "user": map[string]interface{}{ |
| 204 | "id": "an ID", |
| 205 | "login": "monalisa", |
| 206 | }, |
| 207 | }, |
| 208 | "errors": []interface{}{ |
| 209 | map[string]interface{}{ |
| 210 | "type": "NOT_FOUND", |
| 211 | "path": []string{"organization"}, |
| 212 | }, |
| 213 | }, |
| 214 | }) |
| 215 | |
| 216 | // get user project ID |
| 217 | gock.New("https://api.github.com"). |
| 218 | Post("/graphql"). |
| 219 | MatchType("json"). |
| 220 | JSON(map[string]interface{}{ |
| 221 | "query": "query UserProject.*", |
| 222 | "variables": map[string]interface{}{ |
| 223 | "login": "monalisa", |
| 224 | "number": 1, |
| 225 | "firstItems": 0, |
| 226 | "afterItems": nil, |
| 227 | "firstFields": 0, |
| 228 | "afterFields": nil, |
| 229 | }, |
| 230 | }). |
| 231 | Reply(200). |
| 232 | JSON(map[string]interface{}{ |
| 233 | "data": map[string]interface{}{ |
| 234 | "user": map[string]interface{}{ |
| 235 | "projectV2": map[string]string{ |
| 236 | "id": "project-ID", |
| 237 | "title": "first-project", |
| 238 | }, |
| 239 | }, |
| 240 | }, |
| 241 | }) |
| 242 | |
| 243 | // unlink projectV2 from repository |
nothing calls this directly
no test coverage detected