MCPcopy
hub / github.com/cli/cli / TestRunViewWeb_User

Function TestRunViewWeb_User

pkg/cmd/project/view/view_test.go:301–377  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

299}
300
301func TestRunViewWeb_User(t *testing.T) {
302 defer gock.Off()
303 gock.Observe(gock.DumpRequest)
304 // get user ID
305 gock.New("https://api.github.com").
306 Post("/graphql").
307 MatchType("json").
308 JSON(map[string]interface{}{
309 "query": "query UserOrgOwner.*",
310 "variables": map[string]interface{}{
311 "login": "monalisa",
312 },
313 }).
314 Reply(200).
315 JSON(map[string]interface{}{
316 "data": map[string]interface{}{
317 "user": map[string]interface{}{
318 "id": "an ID",
319 },
320 },
321 "errors": []interface{}{
322 map[string]interface{}{
323 "type": "NOT_FOUND",
324 "path": []string{"organization"},
325 },
326 },
327 })
328
329 gock.New("https://api.github.com").
330 Post("/graphql").
331 Reply(200).
332 JSON(`
333 {"data":
334 {"user":
335 {
336 "login":"monalisa",
337 "projectV2": {
338 "number": 8,
339 "items": {
340 "totalCount": 10
341 },
342 "url":"https://github.com/users/monalisa/projects/8",
343 "readme": null,
344 "fields": {
345 "nodes": [
346 {
347 "name": "Title"
348 }
349 ]
350 }
351 }
352 }
353 }
354 }
355 `)
356
357 client := queries.NewTestClient()
358 buf := bytes.Buffer{}

Callers

nothing calls this directly

Calls 6

NewTestClientFunction · 0.92
TestFunction · 0.92
ReplyMethod · 0.80
EqualMethod · 0.80
runViewFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected