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

Function TestRunCreateField_User

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

Source from the content-addressed store, hash-verified

117}
118
119func 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").

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