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

Function Test_List

pkg/cmd/run/download/http_test.go:18–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16)
17
18func Test_List(t *testing.T) {
19 reg := &httpmock.Registry{}
20 defer reg.Verify(t)
21
22 reg.Register(
23 httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/123/artifacts"),
24 httpmock.StringResponse(`{
25 "total_count": 2,
26 "artifacts": [
27 {"name": "artifact-1"},
28 {"name": "artifact-2"}
29 ]
30 }`))
31
32 api := &apiPlatform{
33 client: &http.Client{Transport: reg},
34 repo: ghrepo.New("OWNER", "REPO"),
35 }
36 artifacts, err := api.List("123")
37 require.NoError(t, err)
38
39 require.Equal(t, 2, len(artifacts))
40 assert.Equal(t, "artifact-1", artifacts[0].Name)
41 assert.Equal(t, "artifact-2", artifacts[1].Name)
42}
43
44func Test_List_perRepository(t *testing.T) {
45 reg := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 7

VerifyMethod · 0.95
RegisterMethod · 0.95
ListMethod · 0.95
RESTFunction · 0.92
StringResponseFunction · 0.92
NewFunction · 0.92
EqualMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…