MCPcopy
hub / github.com/cli/cli / TestRunCopy_User

Function TestRunCopy_User

pkg/cmd/project/copy/copy_test.go:115–235  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected