diff --git a/backend/test/uxbox/tests/main.clj b/backend/test/uxbox/tests/main.clj
index 60665eae6..74d9e54d2 100644
--- a/backend/test/uxbox/tests/main.clj
+++ b/backend/test/uxbox/tests/main.clj
@@ -14,6 +14,8 @@
(require 'uxbox.tests.test-images)
(require 'uxbox.tests.test-icons)
(require 'uxbox.tests.test-users)
+ (require 'uxbox.tests.test-auth)
+ (require 'uxbox.tests.test-kvstore)
(let [{:keys [fail]} (test/run-all-tests #"^uxbox.tests.*")]
(if (pos? fail)
(System/exit fail)
diff --git a/backend/test/uxbox/tests/test_auth.clj b/backend/test/uxbox/tests/test_auth.clj
index b4a8a3d55..e1c1b7805 100644
--- a/backend/test/uxbox/tests/test_auth.clj
+++ b/backend/test/uxbox/tests/test_auth.clj
@@ -2,52 +2,51 @@
(:require [clojure.test :as t]
[promesa.core :as p]
[clj-http.client :as http]
- [catacumba.testing :refer (with-server)]
[buddy.hashers :as hashers]
[uxbox.db :as db]
- [uxbox.frontend :as uft]
+ [uxbox.api :as uapi]
[uxbox.services.users :as usu]
[uxbox.services :as usv]
[uxbox.tests.helpers :as th]))
+(t/use-fixtures :once th/state-init)
(t/use-fixtures :each th/database-reset)
-;; (t/deftest test-http-success-auth
-;; (let [data {:username "user1"
-;; :fullname "user 1"
-;; :metadata "1"
-;; :password "user1"
-;; :email "user1@uxbox.io"}
-;; user (with-open [conn (db/connection)]
-;; (usu/create-user conn data))]
-;; (with-server {:handler (uft/routes)}
-;; (let [data {:username "user1"
-;; :password "user1"
-;; :metadata "1"
-;; :scope "foobar"}
-;; uri (str th/+base-url+ "/api/auth/token")
-;; [status data] (th/http-post uri {:body data})]
-;; ;; (println "RESPONSE:" status data)
-;; (t/is (= status 200))
-;; (t/is (contains? data :token))))))
+(t/deftest test-http-success-auth
+ (let [data {:username "user1"
+ :fullname "user 1"
+ :metadata "1"
+ :password "user1"
+ :email "user1@uxbox.io"}
+ user (with-open [conn (db/connection)]
+ (usu/create-user conn data))]
+ (th/with-server {:handler uapi/app}
+ (let [data {:username "user1"
+ :password "user1"
+ :metadata "1"
+ :scope "foobar"}
+ uri (str th/+base-url+ "/auth/login")
+ [status data] (th/http-post uri {:body data})]
+ (println "RESPONSE:" status data)
+ (t/is (= status 204))))))
-;; (t/deftest test-http-failed-auth
-;; (let [data {:username "user1"
-;; :fullname "user 1"
-;; :metadata "1"
-;; :password (hashers/encrypt "user1")
-;; :email "user1@uxbox.io"}
-;; user (with-open [conn (db/connection)]
-;; (usu/create-user conn data))]
-;; (with-server {:handler (uft/routes)}
-;; (let [data {:username "user1"
-;; :password "user2"
-;; :metadata "2"
-;; :scope "foobar"}
-;; uri (str th/+base-url+ "/api/auth/token")
-;; [status data] (th/http-post uri {:body data})]
-;; ;; (println "RESPONSE:" status data)
-;; (t/is (= 400 status))
-;; (t/is (= (:type data) :validation))
-;; (t/is (= (:code data) :uxbox.services.auth/wrong-credentials))))))
+(t/deftest test-http-failed-auth
+ (let [data {:username "user1"
+ :fullname "user 1"
+ :metadata "1"
+ :password (hashers/encrypt "user1")
+ :email "user1@uxbox.io"}
+ user (with-open [conn (db/connection)]
+ (usu/create-user conn data))]
+ (th/with-server {:handler uapi/app}
+ (let [data {:username "user1"
+ :password "user2"
+ :metadata "2"
+ :scope "foobar"}
+ uri (str th/+base-url+ "/auth/login")
+ [status data] (th/http-post uri {:body data})]
+ ;; (prn "RESPONSE:" status data)
+ (t/is (= 400 status))
+ (t/is (= (:type data) :validation))
+ (t/is (= (:code data) :uxbox.services.auth/wrong-credentials))))))
diff --git a/backend/test/uxbox/tests/test_kvstore.clj b/backend/test/uxbox/tests/test_kvstore.clj
index deef2bb3e..1b34c417d 100644
--- a/backend/test/uxbox/tests/test_kvstore.clj
+++ b/backend/test/uxbox/tests/test_kvstore.clj
@@ -2,64 +2,65 @@
(:require [clojure.test :as t]
[promesa.core :as p]
[suricatta.core :as sc]
- [catacumba.testing :refer (with-server)]
[buddy.core.codecs :as codecs]
[uxbox.db :as db]
[uxbox.util.uuid :as uuid]
- [uxbox.frontend :as uft]
+ [uxbox.api :as uapi]
[uxbox.services.kvstore :as kvs]
[uxbox.tests.helpers :as th]))
-;; (t/use-fixtures :each th/database-reset)
+(t/use-fixtures :once th/state-init)
+(t/use-fixtures :each th/database-reset)
-;; (t/deftest test-http-kvstore
-;; (with-open [conn (db/connection)]
-;; (let [{:keys [id] :as user} (th/create-user conn 1)]
-;; ;; Not exists at this moment
-;; (t/is (nil? (kvs/retrieve-kvstore conn {:user id :key "foo" :version -1})))
+(t/deftest test-http-kvstore
+ (with-open [conn (db/connection)]
+ (let [{:keys [id] :as user} (th/create-user conn 1)]
-;; ;; Creating new one should work as expected
-;; (with-server {:handler (uft/routes)}
-;; (let [uri (str th/+base-url+ "/api/kvstore")
-;; body {:key "foo" :value "bar" :version -1}
-;; params {:body body}
-;; [status data] (th/http-put user uri params)]
-;; (println "RESPONSE:" status data)
-;; (t/is (= 200 status))
-;; (t/is (= (:key data) "foo"))
-;; (t/is (= (:value data) "bar"))))
+ ;; Not exists at this moment
+ (t/is (nil? (kvs/retrieve-kvstore conn {:user id :key "foo" :version -1})))
-;; ;; Should exists
-;; (let [data (kvs/retrieve-kvstore conn {:user id :key "foo"})]
-;; (t/is (= (:key data) "foo"))
-;; (t/is (= (:value data) "bar"))
+ ;; Creating new one should work as expected
+ (th/with-server {:handler uapi/app}
+ (let [uri (str th/+base-url+ "/api/kvstore/foo")
+ body {:value "bar" :version -1}
+ params {:body body}
+ [status data] (th/http-put user uri params)]
+ ;; (println "RESPONSE:" status data)
+ (t/is (= 200 status))
+ (t/is (= (:key data) "foo"))
+ (t/is (= (:value data) "bar"))))
-;; ;; Overwriting should work
-;; (with-server {:handler (uft/routes)}
-;; (let [uri (str th/+base-url+ "/api/kvstore")
-;; body (assoc data :key "foo" :value "baz")
-;; params {:body body}
-;; [status data] (th/http-put user uri params)]
-;; (println "RESPONSE:" status data)
-;; (t/is (= 200 status))
-;; (t/is (= (:key data) "foo"))
-;; (t/is (= (:value data) "baz")))))
+ ;; Should exists
+ (let [data (kvs/retrieve-kvstore conn {:user id :key "foo"})]
+ (t/is (= (:key data) "foo"))
+ (t/is (= (:value data) "bar"))
-;; ;; Should exists and match the overwritten value
-;; (let [data (kvs/retrieve-kvstore conn {:user id :key "foo"})]
-;; (t/is (= (:key data) "foo"))
-;; (t/is (= (:value data) "baz")))
+ ;; Overwriting should work
+ (th/with-server {:handler uapi/app}
+ (let [uri (str th/+base-url+ "/api/kvstore/foo")
+ body (assoc data :value "baz")
+ _ (prn body)
+ [status data] (th/http-put user uri {:body body})]
+ ;; (println "RESPONSE:" status data)
+ (t/is (= 200 status))
+ (t/is (= (:key data) "foo"))
+ (t/is (= (:value data) "baz")))))
-;; ;; Delete should work
-;; (with-server {:handler (uft/routes)}
-;; (let [uri (str th/+base-url+ "/api/kvstore/foo")
-;; [status data] (th/http-delete user uri)]
-;; (println "RESPONSE:" status data)
-;; (t/is (= 204 status))))
+ ;; Should exists and match the overwritten value
+ (let [data (kvs/retrieve-kvstore conn {:user id :key "foo"})]
+ (t/is (= (:key data) "foo"))
+ (t/is (= (:value data) "baz")))
-;; ;; Not exists at this moment
-;; (t/is (nil? (kvs/retrieve-kvstore conn {:user id :key "foo"})))
+ ;; Delete should work
+ (th/with-server {:handler uapi/app}
+ (let [uri (str th/+base-url+ "/api/kvstore/foo")
+ [status data] (th/http-delete user uri)]
+ ;; (println "RESPONSE:" status data)
+ (t/is (= 204 status))))
-;; )))
+ ;; Not exists at this moment
+ (t/is (nil? (kvs/retrieve-kvstore conn {:user id :key "foo"})))
+
+ )))
diff --git a/backend/test/uxbox/tests/test_svgparse.clj b/backend/test/uxbox/tests/test_svgparse.clj
index 50ec6ad33..6e462e702 100644
--- a/backend/test/uxbox/tests/test_svgparse.clj
+++ b/backend/test/uxbox/tests/test_svgparse.clj
@@ -1,89 +1,90 @@
(ns uxbox.tests.test-svgparse
(:require [clojure.test :as t]
[clojure.java.io :as io]
- [catacumba.testing :refer [with-server]]
- [uxbox.frontend :as uft]
+ [uxbox.api :as uapi]
[uxbox.services :as usv]
[uxbox.services.svgparse :as svg]
[uxbox.tests.helpers :as th]))
-;; (t/use-fixtures :each th/state-init)
+(t/use-fixtures :once th/state-init)
-;; (t/deftest parse-svg-test
-;; (t/testing "parsing valid svg 1"
-;; (let [image (slurp (io/resource "uxbox/tests/_files/sample1.svg"))
-;; result (svg/parse-string image)]
-;; (t/is (contains? result :width))
-;; (t/is (contains? result :height))
-;; (t/is (contains? result :view-box))
-;; (t/is (contains? result :name))
-;; (t/is (contains? result :content))
-;; (t/is (= 500.0 (:width result)))
-;; (t/is (= 500.0 (:height result)))
-;; (t/is (= [0.0 0.0 500.00001 500.00001] (:view-box result)))
-;; (t/is (= "lock.svg" (:name result)))))
+(t/deftest parse-svg-test
+ (t/testing "parsing valid svg 1"
+ (let [image (slurp (io/resource "uxbox/tests/_files/sample1.svg"))
+ result (svg/parse-string image)]
+ (t/is (contains? result :width))
+ (t/is (contains? result :height))
+ (t/is (contains? result :view-box))
+ (t/is (contains? result :name))
+ (t/is (contains? result :content))
+ (t/is (= 500.0 (:width result)))
+ (t/is (= 500.0 (:height result)))
+ (t/is (= [0.0 0.0 500.00001 500.00001] (:view-box result)))
+ (t/is (= "lock.svg" (:name result)))))
-;; (t/testing "parsing valid svg 2"
-;; (let [image (slurp (io/resource "uxbox/tests/_files/sample2.svg"))
-;; result (svg/parse-string image)]
-;; (t/is (contains? result :width))
-;; (t/is (contains? result :height))
-;; (t/is (contains? result :view-box))
-;; (t/is (contains? result :name))
-;; (t/is (contains? result :content))
-;; (t/is (= 500.0 (:width result)))
-;; (t/is (= 500.0 (:height result)))
-;; (t/is (= [0.0 0.0 500.0 500.00001] (:view-box result)))
-;; (t/is (= "play.svg" (:name result)))))
+ (t/testing "parsing valid svg 2"
+ (let [image (slurp (io/resource "uxbox/tests/_files/sample2.svg"))
+ result (svg/parse-string image)]
+ (t/is (contains? result :width))
+ (t/is (contains? result :height))
+ (t/is (contains? result :view-box))
+ (t/is (contains? result :name))
+ (t/is (contains? result :content))
+ (t/is (= 500.0 (:width result)))
+ (t/is (= 500.0 (:height result)))
+ (t/is (= [0.0 0.0 500.0 500.00001] (:view-box result)))
+ (t/is (= "play.svg" (:name result)))))
-;; (t/testing "parsing invalid data 1"
-;; (let [image (slurp (io/resource "uxbox/tests/_files/sample.jpg"))
-;; [e result] (th/try-on (svg/parse-string image))]
-;; (t/is (th/exception? e))
-;; (t/is (th/ex-info? e))
-;; (t/is (th/ex-with-code? e :uxbox.services.svgparse/invalid-input))))
+ (t/testing "parsing invalid data 1"
+ (let [image (slurp (io/resource "uxbox/tests/_files/sample.jpg"))
+ [e result] (th/try-on (svg/parse-string image))]
+ (t/is (th/exception? e))
+ (t/is (th/ex-info? e))
+ (t/is (th/ex-with-code? e :uxbox.services.svgparse/invalid-input))))
-;; (t/testing "parsing invalid data 2"
-;; (let [[e result] (th/try-on (svg/parse-string ""))]
-;; (t/is (th/exception? e))
-;; (t/is (th/ex-info? e))
-;; (t/is (th/ex-with-code? e :uxbox.services.svgparse/invalid-input))))
+ (t/testing "parsing invalid data 2"
+ (let [[e result] (th/try-on (svg/parse-string ""))]
+ (t/is (th/exception? e))
+ (t/is (th/ex-info? e))
+ (t/is (th/ex-with-code? e :uxbox.services.svgparse/invalid-input))))
-;; (t/testing "parsing invalid data 3"
-;; (let [[e result] (th/try-on (svg/parse-string ""))]
-;; (t/is (th/exception? e))
-;; (t/is (th/ex-info? e))
-;; (t/is (th/ex-with-code? e :uxbox.services.svgparse/invalid-result))))
+ (t/testing "parsing invalid data 3"
+ (let [[e result] (th/try-on (svg/parse-string ""))]
+ (t/is (th/exception? e))
+ (t/is (th/ex-info? e))
+ (t/is (th/ex-with-code? e :uxbox.services.svgparse/invalid-result))))
-;; (t/testing "valid http request"
-;; (let [image (slurp (io/resource "uxbox/tests/_files/sample2.svg"))
-;; path "/api/svg/parse"]
-;; (with-server {:handler (uft/routes)}
-;; (let [rsp (th/request {:method :post
-;; :path path
-;; :body image
-;; :raw? true})]
-;; (t/is (= 200 (:status rsp)))
-;; (t/is (contains? (:body rsp) :width))
-;; (t/is (contains? (:body rsp) :height))
-;; (t/is (contains? (:body rsp) :view-box))
-;; (t/is (contains? (:body rsp) :name))
-;; (t/is (contains? (:body rsp) :content))
-;; (t/is (= 500.0 (:width (:body rsp))))
-;; (t/is (= 500.0 (:height (:body rsp))))
-;; (t/is (= [0.0 0.0 500.0 500.00001] (:view-box (:body rsp))))
-;; (t/is (= "play.svg" (:name (:body rsp))))))))
+ ;; (t/testing "valid http request"
+ ;; (with-open [conn (db/connection)]
+ ;; (let [image (slurp (io/resource "uxbox/tests/_files/sample2.svg"))
+ ;; path "/api/svg/parse"
+ ;; user (th/create-user conn 1)]
+ ;; (th/with-server {:handler uapi/app}
+ ;; (let [rsp (th/request {:method :post
+ ;; :path path
+ ;; :body image
+ ;; :raw? true})]
+ ;; (t/is (= 200 (:status rsp)))
+ ;; (prn "RESPONSE" rsp)
+ ;; ;; (t/is (contains? (:body rsp) :width))
+ ;; ;; (t/is (contains? (:body rsp) :height))
+ ;; ;; (t/is (contains? (:body rsp) :view-box))
+ ;; ;; (t/is (contains? (:body rsp) :name))
+ ;; ;; (t/is (contains? (:body rsp) :content))
+ ;; ;; (t/is (= 500.0 (:width (:body rsp))))
+ ;; #_(t/is (= 500.0 (:height (:body rsp))))
+ ;; #_(t/is (= [0.0 0.0 500.0 500.00001] (:view-box (:body rsp))))
+ ;; #_(t/is (= "play.svg" (:name (:body rsp))))))))
-;; (t/testing "invalid http request"
-;; (let [path "/api/svg/parse"
-;; image ""]
-;; (with-server {:handler (uft/routes)}
-;; (let [rsp (th/request {:method :post
-;; :path path
-;; :body image
-;; :raw? true})]
-;; (t/is (= 400 (:status rsp)))
-;; (t/is (= :validation (get-in rsp [:body :type])))
-;; (t/is (= ::svg/invalid-result (get-in rsp [:body :code])))))))
-
-;; )
+ ;; (t/testing "invalid http request"
+ ;; (let [path "/api/svg/parse"
+ ;; image ""]
+ ;; (with-server {:handler (uft/routes)}
+ ;; (let [rsp (th/request {:method :post
+ ;; :path path
+ ;; :body image
+ ;; :raw? true})]
+ ;; (t/is (= 400 (:status rsp)))
+ ;; (t/is (= :validation (get-in rsp [:body :type])))
+ ;; (t/is (= ::svg/invalid-result (get-in rsp [:body :code])))))))
+ )