aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/clj/queue_api/test/handler.clj42
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))))))