(c *C)
| 131 | } |
| 132 | |
| 133 | func (s *CompressionSuite) TestDownloadTryCompressionErrors(c *C) { |
| 134 | d := NewFakeDownloader() |
| 135 | _, _, err := DownloadTryCompression(s.ctx, d, s.baseURL, "file", nil, true) |
| 136 | c.Assert(err, ErrorMatches, "unexpected request.*") |
| 137 | |
| 138 | d = NewFakeDownloader() |
| 139 | d.ExpectError("http://example.com/file.bz2", &Error{Code: 404}) |
| 140 | d.ExpectError("http://example.com/file.gz", &Error{Code: 404}) |
| 141 | d.ExpectError("http://example.com/file.xz", &Error{Code: 404}) |
| 142 | d.ExpectError("http://example.com/file", errors.New("403")) |
| 143 | _, _, err = DownloadTryCompression(s.ctx, d, s.baseURL, "file", nil, true) |
| 144 | c.Assert(err, ErrorMatches, "403") |
| 145 | |
| 146 | d = NewFakeDownloader() |
| 147 | d.ExpectError("http://example.com/file.bz2", &Error{Code: 404}) |
| 148 | d.ExpectError("http://example.com/file.gz", &Error{Code: 404}) |
| 149 | d.ExpectError("http://example.com/file.xz", &Error{Code: 404}) |
| 150 | d.ExpectResponse("http://example.com/file", rawData) |
| 151 | expectedChecksums := map[string]utils.ChecksumInfo{ |
| 152 | "file.bz2": {Size: 7}, |
| 153 | "file.gz": {Size: 7}, |
| 154 | "file.xz": {Size: 7}, |
| 155 | "file": {Size: 7}, |
| 156 | } |
| 157 | _, _, err = DownloadTryCompression(s.ctx, d, s.baseURL, "file", expectedChecksums, false) |
| 158 | c.Assert(err, ErrorMatches, "checksums don't match.*") |
| 159 | } |
nothing calls this directly
no test coverage detected