(t *testing.T)
| 16 | ) |
| 17 | |
| 18 | func 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 | |
| 44 | func Test_List_perRepository(t *testing.T) { |
| 45 | reg := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected
searching dependent graphs…