(t *testing.T)
| 32 | } |
| 33 | |
| 34 | func TestImageList(t *testing.T) { |
| 35 | const expectedURL = "/images/json" |
| 36 | |
| 37 | tests := []struct { |
| 38 | doc string |
| 39 | options ImageListOptions |
| 40 | expectedQueryParams map[string]string |
| 41 | }{ |
| 42 | { |
| 43 | doc: "no options", |
| 44 | options: ImageListOptions{}, |
| 45 | expectedQueryParams: map[string]string{ |
| 46 | "all": "", |
| 47 | "filter": "", |
| 48 | "filters": "", |
| 49 | }, |
| 50 | }, |
| 51 | { |
| 52 | doc: "label filters and dangling", |
| 53 | options: ImageListOptions{ |
| 54 | Filters: make(Filters). |
| 55 | Add("label", "label1"). |
| 56 | Add("label", "label2"). |
| 57 | Add("dangling", "true"), |
| 58 | }, |
| 59 | expectedQueryParams: map[string]string{ |
| 60 | "all": "", |
| 61 | "filter": "", |
| 62 | "filters": `{"dangling":{"true":true},"label":{"label1":true,"label2":true}}`, |
| 63 | }, |
| 64 | }, |
| 65 | { |
| 66 | doc: "label filters no dangling", |
| 67 | options: ImageListOptions{ |
| 68 | Filters: make(Filters).Add("dangling", "false"), |
| 69 | }, |
| 70 | expectedQueryParams: map[string]string{ |
| 71 | "all": "", |
| 72 | "filter": "", |
| 73 | "filters": `{"dangling":{"false":true}}`, |
| 74 | }, |
| 75 | }, |
| 76 | { |
| 77 | doc: "with shared size", |
| 78 | options: ImageListOptions{ |
| 79 | SharedSize: true, |
| 80 | }, |
| 81 | expectedQueryParams: map[string]string{ |
| 82 | "shared-size": "1", |
| 83 | }, |
| 84 | }, |
| 85 | { |
| 86 | doc: "with identity", |
| 87 | options: ImageListOptions{ |
| 88 | Identity: true, |
| 89 | }, |
| 90 | expectedQueryParams: map[string]string{ |
| 91 | "identity": "1", |
nothing calls this directly
no test coverage detected
searching dependent graphs…