Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Commit

Permalink
Add handler-test for latest endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
flosell committed Oct 11, 2016
1 parent 2a2c478 commit 3a875aa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/lambdacd_artifacts/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,17 @@
pipeline (pipeline-with-homedir home-dir)
handler (artifact-handler-for pipeline)]
(spit (file-path-for home-dir 1 "2-3" "some-file") "hello world")
(spit (file-path-for home-dir 12 "2-3" "some-file") "hello world again")
(spit (file-path-for home-dir 1 "2-3" "some-sub-folder" "some-file") "hello world from subfolder")

(testing "that it returns existing artifacts correctly"
(let [response (handler (mock/request :get "/1/2-3/some-file"))]
(is (= 200 (:status response)))
(is (= (file-path-for home-dir 1 "2-3" "some-file") (:body response)))))
(testing "that it returns the latest artifacts correctly"
(let [response (handler (mock/request :get "/latest/2-3/some-file"))]
(is (= 200 (:status response)))
(is (= (file-path-for home-dir 12 "2-3" "some-file") (:body response)))))
(testing "that it returns existing artifacts in subfolders correctly"
(let [response (handler (mock/request :get "/1/2-3/some-sub-folder/some-file"))]
(is (= 200 (:status response)))
Expand Down

0 comments on commit 3a875aa

Please sign in to comment.