MCPcopy Create free account
hub / github.com/cli/cli / TestList

Function TestList

pkg/cmd/issue/artifact/client/client_test.go:157–379  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

155}
156
157func TestList(t *testing.T) {
158 const listURL = "https://api.github.com/repos/monalisa/monas-cafe/issues/142/artifacts"
159 const tenancyListURL = "https://api.monas-cafe.ghe.com/repos/monalisa/monas-cafe/issues/142/artifacts"
160
161 createdAt := time.Date(2026, 9, 21, 23, 0, 0, 0, time.UTC)
162 updatedAt := time.Date(2026, 9, 24, 21, 0, 0, 0, time.UTC)
163
164 tests := []struct {
165 name string
166 repo ghrepo.Interface
167 artifactType string
168 limit int
169 pages []httpmock.Responder
170 want []Artifact
171 wantNumbers []int
172 wantURLs []string
173 wantErr string
174 }{
175 {
176 name: "decodes every field, and null users and timestamps",
177 repo: ghrepo.New("monalisa", "monas-cafe"),
178 pages: []httpmock.Responder{
179 httpmock.StringResponse(`[
180 {
181 "id": 6626,
182 "number": 2,
183 "type": "generic",
184 "name": "OAuth callback plan",
185 "body": "# OAuth callback plan",
186 "body_html": "<h1>OAuth callback plan</h1>",
187 "description": "Register the callback URL.",
188 "creator": {"login": "hubot", "id": 2},
189 "updated_by_actor": {"login": "monalisa", "id": 1},
190 "created_at": "2026-09-21T23:00:00Z",
191 "updated_at": "2026-09-24T21:00:00Z",
192 "html_url": "https://github.com/monalisa/monas-cafe/issues/142/artifacts/2"
193 },
194 {
195 "id": 6627,
196 "number": 3,
197 "type": "link",
198 "name": "Staging OAuth runbook",
199 "body": "https://github.com/monalisa/monas-cafe/wiki/OAuth-runbook",
200 "body_html": "",
201 "description": "",
202 "creator": null,
203 "updated_by_actor": null,
204 "created_at": null,
205 "updated_at": null,
206 "html_url": "https://github.com/monalisa/monas-cafe/issues/142/artifacts/3"
207 }
208 ]`),
209 },
210 want: []Artifact{
211 {
212 ID: 6626,
213 Number: 2,
214 Type: "generic",

Callers

nothing calls this directly

Calls 14

VerifyMethod · 0.95
RegisterMethod · 0.95
ListMethod · 0.95
NewFunction · 0.92
StringResponseFunction · 0.92
NewWithHostFunction · 0.92
StatusJSONResponseFunction · 0.92
RESTFunction · 0.92
artifactsPageFunction · 0.85
numbersFunction · 0.85
NewArtifactClientFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected