(t *testing.T)
| 117 | } |
| 118 | |
| 119 | func TestRunCreateField_User(t *testing.T) { |
| 120 | defer gock.Off() |
| 121 | gock.Observe(gock.DumpRequest) |
| 122 | |
| 123 | // get user ID |
| 124 | gock.New("https://api.github.com"). |
| 125 | Post("/graphql"). |
| 126 | MatchType("json"). |
| 127 | JSON(map[string]interface{}{ |
| 128 | "query": "query UserOrgOwner.*", |
| 129 | "variables": map[string]interface{}{ |
| 130 | "login": "monalisa", |
| 131 | }, |
| 132 | }). |
| 133 | Reply(200). |
| 134 | JSON(map[string]interface{}{ |
| 135 | "data": map[string]interface{}{ |
| 136 | "user": map[string]interface{}{ |
| 137 | "id": "an ID", |
| 138 | }, |
| 139 | }, |
| 140 | "errors": []interface{}{ |
| 141 | map[string]interface{}{ |
| 142 | "type": "NOT_FOUND", |
| 143 | "path": []string{"organization"}, |
| 144 | }, |
| 145 | }, |
| 146 | }) |
| 147 | |
| 148 | // get project ID |
| 149 | gock.New("https://api.github.com"). |
| 150 | Post("/graphql"). |
| 151 | MatchType("json"). |
| 152 | JSON(map[string]interface{}{ |
| 153 | "query": "query UserProject.*", |
| 154 | "variables": map[string]interface{}{ |
| 155 | "login": "monalisa", |
| 156 | "number": 1, |
| 157 | "firstItems": 0, |
| 158 | "afterItems": nil, |
| 159 | "firstFields": 0, |
| 160 | "afterFields": nil, |
| 161 | }, |
| 162 | }). |
| 163 | Reply(200). |
| 164 | JSON(map[string]interface{}{ |
| 165 | "data": map[string]interface{}{ |
| 166 | "user": map[string]interface{}{ |
| 167 | "projectV2": map[string]interface{}{ |
| 168 | "id": "an ID", |
| 169 | }, |
| 170 | }, |
| 171 | }, |
| 172 | }) |
| 173 | |
| 174 | // create Field |
| 175 | gock.New("https://api.github.com"). |
| 176 | Post("/graphql"). |
nothing calls this directly
no test coverage detected