diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2018-02-17 22:41:00 -0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2018-02-17 22:41:00 -0200 |
commit | 64773838cb5c177994a7d86b557ea464fa06dcd2 (patch) | |
tree | bf11003fc2bd02b8dc9e534b35a8209ac4f8eabb /test/clj/queue_api | |
parent | 2198d8990da4535b6d81cf7008b85e5c14c3e0f3 (diff) | |
download | queue-api-64773838cb5c177994a7d86b557ea464fa06dcd2.tar.gz queue-api-64773838cb5c177994a7d86b557ea464fa06dcd2.tar.bz2 queue-api-64773838cb5c177994a7d86b557ea464fa06dcd2.zip |
Adds test for service.clj
Diffstat (limited to 'test/clj/queue_api')
-rw-r--r-- | test/clj/queue_api/test/handler.clj | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/test/clj/queue_api/test/handler.clj b/test/clj/queue_api/test/handler.clj index 1aceb3c..aa0dfa1 100644 --- a/test/clj/queue_api/test/handler.clj +++ b/test/clj/queue_api/test/handler.clj @@ -8,14 +8,46 @@ :once (fn [f] (mount/start #'queue-api.config/env - #'queue-api.handler/app) + #'queue-api.handler/app + #'queue-api.db.core/conn) + (f))) -(deftest test-app - (testing "main route" - (let [response (app (request :get "/"))] - (is (= 200 (:status response))))) +(deftest agent-test + (testing "Agent route" + (let [response (-> (request :put "/agent") + (json-body {:id "8ab86c18-3fae-4804-bfd9-c3d6e8f66260" + :name "Dummy" + :primary_skillset ["reward_request"] + :secondary_skillset []}) + app)] + (is (= 200 (:status response)))) + (let [response (-> (request :post "/agent") + (json-body {:agent_id "8ab86c18-3fae-4804-bfd9-c3d6e8f66260"}) + app)] + (is (= 200 (:status response)))))) + +(deftest job-test + (testing "Job route" + (let [response (-> (request :put "/job") + (json-body {:id "895e9b31-5690-486e-b8dd-5c2345e056f6" + :type "bills_request" + :urgent false}) + app)] + (is (= 200 (:status response)))) + (let [response (-> (request :post "/job") + (json-body {:agent_id "8ab86c18-3fae-4804-bfd9-c3d6e8f66260"}) + app)] + (is (= 200 (:status response)))))) + +(deftest queue-test + (testing "Queue route" + (let [response (app (request :get "/queue"))] + (is (= 200 (:status response)))))) + +(deftest queue "/queue") +(deftest invalid-test (testing "not-found route" (let [response (app (request :get "/invalid"))] (is (= 404 (:status response)))))) |