diff --git a/backend/src/uxbox/http/middleware.clj b/backend/src/uxbox/http/middleware.clj index c08620eae..41731eb86 100644 --- a/backend/src/uxbox/http/middleware.clj +++ b/backend/src/uxbox/http/middleware.clj @@ -55,7 +55,6 @@ (try (handler (transform request) respond raise) (catch Exception e - (prn handler) (raise e))))))))}) (def ^:private multipart-params-middleware diff --git a/backend/test/uxbox/tests/test_auth.clj b/backend/test/uxbox/tests/test_auth.clj index e2d997429..44c335f8b 100644 --- a/backend/test/uxbox/tests/test_auth.clj +++ b/backend/test/uxbox/tests/test_auth.clj @@ -19,7 +19,7 @@ :email "user1@uxbox.io"} user (with-open [conn (db/connection)] (usu/create-user conn data))] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [data {:username "user1" :password "user1" :metadata "1" @@ -37,7 +37,7 @@ :email "user1@uxbox.io"} user (with-open [conn (db/connection)] (usu/create-user conn data))] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [data {:username "user1" :password "user2" :metadata "2" diff --git a/backend/test/uxbox/tests/test_icons.clj b/backend/test/uxbox/tests/test_icons.clj index 157d16044..bde6d3860 100644 --- a/backend/test/uxbox/tests/test_icons.clj +++ b/backend/test/uxbox/tests/test_icons.clj @@ -18,7 +18,7 @@ data {:user (:id user) :name "coll1"} coll (icons/create-collection conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/icon-collections") [status data] (th/http-get user uri)] ;; (println "RESPONSE:" status data) @@ -28,7 +28,7 @@ (t/deftest test-http-create-icon-collection (with-open [conn (db/connection)] (let [user (th/create-user conn 1)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/icon-collections") data {:user (:id user) :name "coll1"} @@ -45,7 +45,7 @@ data {:user (:id user) :name "coll1"} coll (icons/create-collection conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/icon-collections/" (:id coll)) params {:body (assoc coll :name "coll2")} [status data] (th/http-put user uri params)] @@ -61,7 +61,7 @@ :name "coll1" :data #{1}} coll (icons/create-collection conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/icon-collections/" (:id coll)) [status data] (th/http-delete user uri)] (t/is (= 204 status)) @@ -72,7 +72,7 @@ (t/deftest test-http-create-icon (with-open [conn (db/connection)] (let [user (th/create-user conn 1)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/icons") data {:name "sample.jpg" :content "<g></g>" @@ -99,7 +99,7 @@ :metadata {} :collection nil} icon (icons/create-icon conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/icons/" (:id icon)) params {:body (assoc icon :name "my stuff")} [status data] (th/http-put user uri params)] @@ -117,7 +117,7 @@ :metadata {} :collection nil} icon (icons/create-icon conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/icons/" (:id icon) "/copy") body {:collection nil} params {:body body} @@ -137,7 +137,7 @@ :metadata {} :collection nil} icon (icons/create-icon conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/icons/" (:id icon)) [status data] (th/http-delete user uri)] (t/is (= 204 status)) @@ -154,7 +154,7 @@ :metadata {} :collection nil} icon (icons/create-icon conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/icons") [status data] (th/http-get user uri)] ;; (println "RESPONSE:" status data) diff --git a/backend/test/uxbox/tests/test_images.clj b/backend/test/uxbox/tests/test_images.clj index e418fe1d4..c1ce9c030 100644 --- a/backend/test/uxbox/tests/test_images.clj +++ b/backend/test/uxbox/tests/test_images.clj @@ -21,7 +21,7 @@ data {:user (:id user) :name "coll1"} coll (images/create-collection conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/image-collections") [status data] (th/http-get user uri)] ;; (println "RESPONSE:" status data) @@ -31,7 +31,7 @@ (t/deftest test-http-create-image-collection (with-open [conn (db/connection)] (let [user (th/create-user conn 1)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/image-collections") data {:user (:id user) :name "coll1"} @@ -48,7 +48,7 @@ data {:user (:id user) :name "coll1"} coll (images/create-collection conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/image-collections/" (:id coll)) params {:body (assoc coll :name "coll2")} [status data] (th/http-put user uri params)] @@ -64,7 +64,7 @@ :name "coll1" :data #{1}} coll (images/create-collection conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/image-collections/" (:id coll)) [status data] (th/http-delete user uri)] (t/is (= 204 status)) @@ -75,7 +75,7 @@ (t/deftest test-http-create-image (with-open [conn (db/connection)] (let [user (th/create-user conn 1)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/images") parts [{:name "sample.jpg" :part-name "upload" @@ -102,7 +102,7 @@ :mimetype "image/png" :collection nil} img (images/create-image conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/images/" (:id img)) params {:body (assoc img :name "my stuff")} [status data] (th/http-put user uri params)] @@ -126,7 +126,7 @@ :mimetype "image/jpg" :collection nil} img (images/create-image conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/images/" (:id img) "/copy") body {:id (:id img) :collection nil} @@ -149,7 +149,7 @@ :mimetype "image/png" :collection nil} img (images/create-image conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/images/" (:id img)) [status data] (th/http-delete user uri)] (t/is (= 204 status)) @@ -168,7 +168,7 @@ :mimetype "image/png" :collection nil} img (images/create-image conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/library/images") [status data] (th/http-get user uri)] ;; (println "RESPONSE:" status data) diff --git a/backend/test/uxbox/tests/test_kvstore.clj b/backend/test/uxbox/tests/test_kvstore.clj index 3fae16ce0..8e5f8fce9 100644 --- a/backend/test/uxbox/tests/test_kvstore.clj +++ b/backend/test/uxbox/tests/test_kvstore.clj @@ -21,7 +21,7 @@ (t/is (nil? (kvs/retrieve-kvstore conn {:user id :key "foo" :version -1}))) ;; Creating new one should work as expected - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/kvstore/foo") body {:value "bar" :version -1} params {:body body} @@ -37,7 +37,7 @@ (t/is (= (:value data) "bar")) ;; Overwriting should work - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/kvstore/foo") body (assoc data :value "baz") _ (prn body) @@ -53,7 +53,7 @@ (t/is (= (:value data) "baz"))) ;; Delete should work - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/kvstore/foo") [status data] (th/http-delete user uri)] ;; (println "RESPONSE:" status data) diff --git a/backend/test/uxbox/tests/test_pages.clj b/backend/test/uxbox/tests/test_pages.clj index 9beff079e..2095549d8 100644 --- a/backend/test/uxbox/tests/test_pages.clj +++ b/backend/test/uxbox/tests/test_pages.clj @@ -17,7 +17,7 @@ (with-open [conn (db/connection)] (let [user (th/create-user conn 1) proj (uspr/create-project conn {:user (:id user) :name "proj1"})] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/pages") params {:body {:project (:id proj) :name "page1" @@ -48,7 +48,7 @@ :height 200 :layout "mobil"} page (uspg/create-page conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ (str "/api/pages/" (:id page))) params {:body (assoc page :data "3")} [status page'] (th/http-put user uri params)] @@ -74,7 +74,7 @@ :height 200 :layout "mobil"} page (uspg/create-page conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ (str "/api/pages/" (:id page) "/metadata")) params {:body (assoc page :data "3")} [status page'] (th/http-put user uri params)] @@ -100,7 +100,7 @@ :height 200 :layout "mobil"} page (uspg/create-page conn data)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ (str "/api/pages/" (:id page))) [status response] (th/http-delete user uri)] ;; (println "RESPONSE:" status response) @@ -125,7 +125,7 @@ :layout "mobil"} page1 (uspg/create-page conn (assoc data :project (:id proj1))) page2 (uspg/create-page conn (assoc data :project (:id proj2)))] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ (str "/api/pages?project=" (:id proj1))) [status response] (th/http-get user uri)] ;; (println "RESPONSE:" status response) @@ -158,7 +158,7 @@ (t/is (= (count result) 101))) ;; Check retrieve all items - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/pages/" (:id page) "/history") [status result] (th/http-get user uri nil)] ;; (println "RESPONSE:" status result) @@ -201,7 +201,7 @@ result (sc/fetch conn [sql (:id data)]) item (first result)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/pages/" (:id page) "/history/" (:id item)) diff --git a/backend/test/uxbox/tests/test_projects.clj b/backend/test/uxbox/tests/test_projects.clj index f50a41718..2229bfeac 100644 --- a/backend/test/uxbox/tests/test_projects.clj +++ b/backend/test/uxbox/tests/test_projects.clj @@ -17,7 +17,7 @@ (with-open [conn (db/connection)] (let [user (th/create-user conn 1) proj (uspr/create-project conn {:user (:id user) :name "proj1"})] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/projects") [status data] (th/http-get user uri)] (t/is (= 200 status)) @@ -26,7 +26,7 @@ (t/deftest test-http-project-create (with-open [conn (db/connection)] (let [user (th/create-user conn 1)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/projects") params {:body {:name "proj1"}} [status data] (th/http-post user uri params)] @@ -39,7 +39,7 @@ (with-open [conn (db/connection)] (let [user (th/create-user conn 1) proj (uspr/create-project conn {:user (:id user) :name "proj1"})] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/projects/" (:id proj)) params {:body (assoc proj :name "proj2")} [status data] (th/http-put user uri params)] @@ -52,7 +52,7 @@ (with-open [conn (db/connection)] (let [user (th/create-user conn 1) proj (uspr/create-project conn {:user (:id user) :name "proj1"})] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/projects/" (:id proj)) [status data] (th/http-delete user uri)] (t/is (= 204 status)) @@ -76,7 +76,7 @@ :height 200 :layout "mobil"}) shares (uspr/get-share-tokens-for-project conn (:id proj))] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [token (:token (first shares)) uri (str th/+base-url+ "/api/projects/by-token/" token) [status data] (th/http-get user uri)] diff --git a/backend/test/uxbox/tests/test_svgparse.clj b/backend/test/uxbox/tests/test_svgparse.clj index 160e67a8d..44cf42147 100644 --- a/backend/test/uxbox/tests/test_svgparse.clj +++ b/backend/test/uxbox/tests/test_svgparse.clj @@ -59,7 +59,7 @@ ;; (let [image (slurp (io/resource "uxbox/tests/_files/sample2.svg")) ;; path "/api/svg/parse" ;; user (th/create-user conn 1)] - ;; (th/with-server {:handler http/app} + ;; (th/with-server {:handler @http/app} ;; (let [rsp (th/request {:method :post ;; :path path ;; :body image diff --git a/backend/test/uxbox/tests/test_users.clj b/backend/test/uxbox/tests/test_users.clj index 47d1b3e15..c2ffb451f 100644 --- a/backend/test/uxbox/tests/test_users.clj +++ b/backend/test/uxbox/tests/test_users.clj @@ -16,7 +16,7 @@ (t/deftest test-http-retrieve-profile (with-open [conn (db/connection)] (let [user (th/create-user conn 1)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/profile/me") [status data] (th/http-get user uri)] ;; (println "RESPONSE:" status data) @@ -30,7 +30,7 @@ (t/deftest test-http-update-profile (with-open [conn (db/connection)] (let [user (th/create-user conn 1)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/profile/me") data (assoc user :fullname "Full Name" @@ -49,7 +49,7 @@ (t/deftest test-http-update-profile-photo (with-open [conn (db/connection)] (let [user (th/create-user conn 1)] - (th/with-server {:handler http/app} + (th/with-server {:handler @http/app} (let [uri (str th/+base-url+ "/api/profile/me/photo") params [{:name "sample.jpg" :part-name "file"