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

Function TestRunView_User

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

Source from the content-addressed store, hash-verified

92}
93
94func TestRunView_User(t *testing.T) {
95 defer gock.Off()
96
97 // get user ID
98 gock.New("https://api.github.com").
99 Post("/graphql").
100 MatchType("json").
101 JSON(map[string]interface{}{
102 "query": "query UserOrgOwner.*",
103 "variables": map[string]interface{}{
104 "login": "monalisa",
105 },
106 }).
107 Reply(200).
108 JSON(map[string]interface{}{
109 "data": map[string]interface{}{
110 "user": map[string]interface{}{
111 "id": "an ID",
112 },
113 },
114 "errors": []interface{}{
115 map[string]interface{}{
116 "type": "NOT_FOUND",
117 "path": []string{"organization"},
118 },
119 },
120 })
121
122 gock.New("https://api.github.com").
123 Post("/graphql").
124 Reply(200).
125 JSON(`
126 {"data":
127 {"user":
128 {
129 "login":"monalisa",
130 "projectV2": {
131 "number": 1,
132 "items": {
133 "totalCount": 10
134 },
135 "readme": null,
136 "fields": {
137 "nodes": [
138 {
139 "name": "Title"
140 }
141 ]
142 }
143 }
144 }
145 }
146 }
147 `)
148
149 client := queries.NewTestClient()
150
151 ios, _, _, _ := iostreams.Test()

Callers

nothing calls this directly

Calls 4

NewTestClientFunction · 0.92
TestFunction · 0.92
ReplyMethod · 0.80
runViewFunction · 0.70

Tested by

no test coverage detected