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

Function Test_List

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

Source from the content-addressed store, hash-verified

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