|
6 | 6 |
|
7 | 7 | (defprofile test-prof
|
8 | 8 | {:resources [{:id :test-resource
|
9 |
| - :url "https://s3.amazonaws.com/cavia/test.png" |
| 9 | + :url "http://localhost:8080/test.png" |
10 | 10 | :sha1 "07dba3bd9f227f58134d339b1609e0a913abe0de"}
|
11 | 11 | {:id :test-resource2
|
12 |
| - :url "https://s3.amazonaws.com/cavia/test.png" |
| 12 | + :url "http://localhost:8080/test.png" |
13 | 13 | :sha1 "unverifiedsha1"}
|
14 | 14 | {:id :test-resource3
|
15 |
| - :url "https://s3.amazonaws.com/cavia/test.png" |
| 15 | + :url "http://localhost:8080/test.png" |
16 | 16 | :md5 "0656b409231ee9bd8c5c9272647c69a1"}
|
17 | 17 | {:id :test-resource4
|
18 |
| - :url "https://s3.amazonaws.com/cavia/test.png" |
| 18 | + :url "http://localhost:8080/test.png" |
19 | 19 | :sha256 "55902cd4056e2bd57ced9296c826e4df42f07457c96ce72afe8652d0d6dd89b3"}
|
20 | 20 | {:id :test-resource-gzip
|
21 |
| - :url "https://s3.amazonaws.com/cavia/test.png.gz" |
| 21 | + :url "http://localhost:8080/test.png.gz" |
22 | 22 | :sha1 "07dba3bd9f227f58134d339b1609e0a913abe0de"
|
23 | 23 | :packed :gzip}
|
24 | 24 | {:id :test-resource-bzip2
|
25 |
| - :url "https://s3.amazonaws.com/cavia/test.png.bz2" |
| 25 | + :url "http://localhost:8080/test.png.bz2" |
26 | 26 | :sha1 "07dba3bd9f227f58134d339b1609e0a913abe0de"
|
27 |
| - :packed :bzip2}]}) |
| 27 | + :packed :bzip2} |
| 28 | + {:id :test-resource-ftp |
| 29 | + :url "ftp://localhost:2221/test.png" |
| 30 | + :sha1 "07dba3bd9f227f58134d339b1609e0a913abe0de" |
| 31 | + :auth {:user "user" :password "password"}} |
| 32 | + {:id :test-resource-s3 |
| 33 | + :url "http://localhost:9000/cavia/test.png" |
| 34 | + :sha1 "07dba3bd9f227f58134d339b1609e0a913abe0de" |
| 35 | + :protocol :s3 |
| 36 | + :auth {:access-key-id "minioadmin" |
| 37 | + :secret-access-key "minioadmin"}}]}) |
28 | 38 |
|
29 | 39 | ;;;
|
30 | 40 | ;;; Setup and teardown
|
|
44 | 54 | ;;; Tests
|
45 | 55 | ;;;
|
46 | 56 |
|
47 |
| -(deftest resource-test |
| 57 | +(deftest ^:integration resource-test |
48 | 58 | (testing "returns the resource's path"
|
49 | 59 | (is (not (nil? (re-find #".*\.cavia/test-resource$" (cavia/resource :test-resource))))))
|
50 | 60 | (testing "return path is absolute"
|
51 | 61 | (is (.isAbsolute (io/file (cavia/resource :test-resource)))))
|
52 | 62 | (testing "returns nil when the id does not exist"
|
53 | 63 | (is (nil? (cavia/resource :notexist)))))
|
54 | 64 |
|
55 |
| -(deftest exist?-test |
| 65 | +(deftest ^:integration exist?-test |
56 | 66 | (testing "returns true if the file is already downloaded"
|
57 |
| - (is (cavia/exist? :test-resource))) |
| 67 | + (are [k] (true? (cavia/exist? k)) |
| 68 | + :test-resource |
| 69 | + :test-resource-ftp |
| 70 | + :test-resource-s3)) |
58 | 71 | (testing "returns false if the file is not downloaded"
|
59 | 72 | (is (not (cavia/exist? :test-resource2)))))
|
60 | 73 |
|
61 |
| -(deftest valid?-test |
| 74 | +(deftest ^:integration valid?-test |
62 | 75 | (testing "returns true if the file's hash is valid"
|
63 |
| - (are [k] (cavia/valid? k) |
| 76 | + (are [k] (true? (cavia/valid? k)) |
64 | 77 | :test-resource
|
65 | 78 | :test-resource3
|
66 |
| - :test-resource4)) |
| 79 | + :test-resource4 |
| 80 | + :test-resource-ftp |
| 81 | + :test-resource-s3)) |
67 | 82 | (testing "returns false if the file's hash is invalid"
|
68 | 83 | (is (not (cavia/valid? :test-resource2)))))
|
69 | 84 |
|
70 |
| -(deftest packed-test |
| 85 | +(deftest ^:integration packed-test |
71 | 86 | (testing "gzip"
|
72 | 87 | (is (cavia/exist? :test-resource-gzip))
|
73 | 88 | (is (cavia/valid? :test-resource-gzip)))
|
|
0 commit comments