MCPcopy Index your code
hub / github.com/cli/cli / TestRunCreateField_Org

Function TestRunCreateField_Org

pkg/cmd/project/field-create/field_create_test.go:212–303  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

210}
211
212func 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").

Callers

nothing calls this directly

Calls 7

NewTestClientFunction · 0.92
TestFunction · 0.92
runCreateFieldFunction · 0.85
ReplyMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected