(t *testing.T)
| 21 | } |
| 22 | |
| 23 | func TestDiskUsage(t *testing.T) { |
| 24 | const expectedURL = "/system/df" |
| 25 | client, err := New(WithMockClient(func(req *http.Request) (*http.Response, error) { |
| 26 | if err := assertRequest(req, http.MethodGet, expectedURL); err != nil { |
| 27 | return nil, err |
| 28 | } |
| 29 | |
| 30 | return mockJSONResponse(http.StatusOK, nil, system.DiskUsage{ |
| 31 | ImageUsage: &image.DiskUsage{ |
| 32 | ActiveCount: 0, |
| 33 | TotalCount: 0, |
| 34 | Reclaimable: 0, |
| 35 | TotalSize: 4096, |
| 36 | Items: []image.Summary{}, |
| 37 | }, |
| 38 | })(req) |
| 39 | })) |
| 40 | assert.NilError(t, err) |
| 41 | |
| 42 | du, err := client.DiskUsage(t.Context(), DiskUsageOptions{}) |
| 43 | assert.NilError(t, err) |
| 44 | assert.Equal(t, du.Images.ActiveCount, int64(0)) |
| 45 | assert.Equal(t, du.Images.TotalCount, int64(0)) |
| 46 | assert.Equal(t, du.Images.Reclaimable, int64(0)) |
| 47 | assert.Equal(t, du.Images.TotalSize, int64(4096)) |
| 48 | assert.Equal(t, len(du.Images.Items), 0) |
| 49 | } |
| 50 | |
| 51 | func TestDiskUsageWithOptions(t *testing.T) { |
| 52 | const expectedURL = "/system/df" |
nothing calls this directly
no test coverage detected
searching dependent graphs…