(t *testing.T)
| 89 | } |
| 90 | |
| 91 | func TestRunClose_User(t *testing.T) { |
| 92 | defer gock.Off() |
| 93 | // gock.Observe(gock.DumpRequest) |
| 94 | |
| 95 | // get user ID |
| 96 | gock.New("https://api.github.com"). |
| 97 | Post("/graphql"). |
| 98 | MatchType("json"). |
| 99 | JSON(map[string]interface{}{ |
| 100 | "query": "query UserOrgOwner.*", |
| 101 | "variables": map[string]interface{}{ |
| 102 | "login": "monalisa", |
| 103 | }, |
| 104 | }). |
| 105 | Reply(200). |
| 106 | JSON(map[string]interface{}{ |
| 107 | "data": map[string]interface{}{ |
| 108 | "user": map[string]interface{}{ |
| 109 | "id": "an ID", |
| 110 | }, |
| 111 | }, |
| 112 | "errors": []interface{}{ |
| 113 | map[string]interface{}{ |
| 114 | "type": "NOT_FOUND", |
| 115 | "path": []string{"organization"}, |
| 116 | }, |
| 117 | }, |
| 118 | }) |
| 119 | |
| 120 | // get user project ID |
| 121 | gock.New("https://api.github.com"). |
| 122 | Post("/graphql"). |
| 123 | MatchType("json"). |
| 124 | JSON(map[string]interface{}{ |
| 125 | "query": "query UserProject.*", |
| 126 | "variables": map[string]interface{}{ |
| 127 | "login": "monalisa", |
| 128 | "number": 1, |
| 129 | "firstItems": 0, |
| 130 | "afterItems": nil, |
| 131 | "firstFields": 0, |
| 132 | "afterFields": nil, |
| 133 | }, |
| 134 | }). |
| 135 | Reply(200). |
| 136 | JSON(map[string]interface{}{ |
| 137 | "data": map[string]interface{}{ |
| 138 | "user": map[string]interface{}{ |
| 139 | "projectV2": map[string]string{ |
| 140 | "id": "an ID", |
| 141 | }, |
| 142 | }, |
| 143 | }, |
| 144 | }) |
| 145 | |
| 146 | // close project |
| 147 | gock.New("https://api.github.com"). |
| 148 | Post("/graphql"). |
nothing calls this directly
no test coverage detected