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

Function TestRunDelete_User

pkg/cmd/project/item-delete/item_delete_test.go:103–190  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

101}
102
103func TestRunDelete_User(t *testing.T) {
104 defer gock.Off()
105 gock.Observe(gock.DumpRequest)
106 // get user ID
107 gock.New("https://api.github.com").
108 Post("/graphql").
109 MatchType("json").
110 JSON(map[string]interface{}{
111 "query": "query UserOrgOwner.*",
112 "variables": map[string]interface{}{
113 "login": "monalisa",
114 },
115 }).
116 Reply(200).
117 JSON(map[string]interface{}{
118 "data": map[string]interface{}{
119 "user": map[string]interface{}{
120 "id": "an ID",
121 },
122 },
123 "errors": []interface{}{
124 map[string]interface{}{
125 "type": "NOT_FOUND",
126 "path": []string{"organization"},
127 },
128 },
129 })
130
131 // get project ID
132 gock.New("https://api.github.com").
133 Post("/graphql").
134 MatchType("json").
135 JSON(map[string]interface{}{
136 "query": "query UserProject.*",
137 "variables": map[string]interface{}{
138 "login": "monalisa",
139 "number": 1,
140 "firstItems": 0,
141 "afterItems": nil,
142 "firstFields": 0,
143 "afterFields": nil,
144 },
145 }).
146 Reply(200).
147 JSON(map[string]interface{}{
148 "data": map[string]interface{}{
149 "user": map[string]interface{}{
150 "projectV2": map[string]interface{}{
151 "id": "an ID",
152 },
153 },
154 },
155 })
156
157 // delete item
158 gock.New("https://api.github.com").
159 Post("/graphql").
160 BodyString(`{"query":"mutation DeleteProjectItem.*","variables":{"input":{"projectId":"an ID","itemId":"item ID"}}}`).

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected