diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/weepinbell/downloader_test.clj | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/weepinbell/downloader_test.clj b/test/weepinbell/downloader_test.clj index 469c9ba..0d92f11 100644 --- a/test/weepinbell/downloader_test.clj +++ b/test/weepinbell/downloader_test.clj @@ -34,11 +34,15 @@ (testing "Exception/Error thrown while downloading"
(with-redefs [weepinbell.http.client/get!
(fn [& _] (throw (.Error "Test error")))]
- (is (false? (download-file "" "")))))
+ (let [dest "tmp/error-thrown-while-downloading"]
+ (io/make-parents dest)
+ (spit "tmp/test" dest)
+ (is (false? (download-file "" "tmp/test"))))))
(testing "Deletes possibly corrupted file when failure is caught"
(with-redefs [weepinbell.http.client/get!
(fn [& _] (throw (.Error "Test error")))]
(let [dest "dest"]
+ (io/make-parents dest)
(spit dest "CORRUPTED")
(is (false? (download-file "" dest)))
(is (not (.exists (io/file dest))))))))
|
