Permalink
Please sign in to comment.
Browse files
Added tests for multipart byte-array and temp-file stores
- Loading branch information...
Showing
with
28 additions
and 0 deletions.
13
ring-core/test/ring/middleware/multipart_params/byte_array_test.clj
| @@ -0,0 +1,13 @@ | ||
| +(ns ring.middleware.multipart-params.byte-array-test | ||
| + (:use clojure.test | ||
| + ring.util.test | ||
| + ring.middleware.multipart-params.byte-array)) | ||
| + | ||
| +(deftest test-byte-array-store | ||
| + (let [result (byte-array-store | ||
| + {:filename "foo.txt" | ||
| + :content-type "text/plain" | ||
| + :stream (string-input-stream "foo")})] | ||
| + (is (= (:filename result) "foo.txt")) | ||
| + (is (= (:content-type result) "text/plain")) | ||
| + (is (= (String. (:bytes result)) "foo")))) |
15
ring-core/test/ring/middleware/multipart_params/temp_file_test.clj
| @@ -0,0 +1,15 @@ | ||
| +(ns ring.middleware.multipart-params.temp-file-test | ||
| + (:use clojure.test | ||
| + ring.util.test | ||
| + ring.middleware.multipart-params.temp-file)) | ||
| + | ||
| +(deftest test-temp-file-store | ||
| + (let [result (temp-file-store | ||
| + {:filename "foo.txt" | ||
| + :content-type "text/plain" | ||
| + :stream (string-input-stream "foo")})] | ||
| + (is (= (:filename result) "foo.txt")) | ||
| + (is (= (:content-type result) "text/plain")) | ||
| + (is (= (:size result) 3)) | ||
| + (is (instance? java.io.File (:tempfile result))) | ||
| + (is (= (slurp (:tempfile result)) "foo")))) |
0 comments on commit
b5f5f2a