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

Function Test_List

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

Source from the content-addressed store, hash-verified

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