diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/abra/core_test.clj | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/test/abra/core_test.clj b/test/abra/core_test.clj index 362a3d1..1207830 100644 --- a/test/abra/core_test.clj +++ b/test/abra/core_test.clj @@ -11,7 +11,8 @@ :uri uri :remote-addr "127.0.0.1" :server-port 8080 - :server-name "something"} + :server-name "something" + :headers {"host" "something:8080"}} handler :body)) @@ -29,7 +30,7 @@ (GET "/fail1" [] (url-for :user)) (GET "/fail2" [] (url-for :user 10 20))) wrap-reverse-routing)] - (is (= (make-request handler "/succeed") "/user/10")) + (is (= (make-request handler "/succeed") "http://something:8080/user/10")) (is (nil? (make-request handler "/fail1"))) (is (nil? (make-request handler "/fail2"))))) @@ -66,9 +67,9 @@ (GET "/fail2" [] (url-for :edit-user)) (GET "/fail3" [] (url-for :edit-user 10 20))) wrap-reverse-routing)] - (is (= (make-request handler "/succeed1") "/user/")) - (is (= (make-request handler "/succeed2") "/user/10/")) - (is (= (make-request handler "/succeed3") "/user/10/edit")) + (is (= (make-request handler "/succeed1") "http://something:8080/user/")) + (is (= (make-request handler "/succeed2") "http://something:8080/user/10/")) + (is (= (make-request handler "/succeed3") "http://something:8080/user/10/edit")) (is (nil? (make-request handler "/fail1"))) (is (nil? (make-request handler "/fail2"))) @@ -91,9 +92,9 @@ (GET "/fail2" [] (url-for :edit-user)) (GET "/fail3" [] (url-for :edit-user 10 20))) wrap-reverse-routing)] - (is (= (make-request handler "/succeed1") "/user/")) - (is (= (make-request handler "/succeed2") "/user/10/")) - (is (= (make-request handler "/succeed3") "/user/10/edit")) + (is (= (make-request handler "/succeed1") "http://something:8080/user/")) + (is (= (make-request handler "/succeed2") "http://something:8080/user/10/")) + (is (= (make-request handler "/succeed3") "http://something:8080/user/10/edit")) (is (nil? (make-request handler "/fail1"))) (is (nil? (make-request handler "/fail2"))) @@ -108,12 +109,12 @@ (GET "/succeed" [] (url-for :user)) (GET "/fail" [] (url-for :user 10))) wrap-reverse-routing)] - (is (= (make-request handler "/succeed") "/user")) + (is (= (make-request handler "/succeed") "http://something:8080/user")) (is (nil? (make-request handler "/fail"))) (var-set subroutes (register-route :user (GET "/not-user" [] (str "user")))) - (is (= (make-request handler "/succeed") "/not-user")) + (is (= (make-request handler "/succeed") "http://something:8080/not-user")) (is (nil? (make-request handler "/fail")))))) (deftest top-level-is-a-var @@ -124,7 +125,7 @@ (GET "/fail1" [] (url-for :user)) (GET "/fail2" [] (url-for :user 10 20)))] (let [handler (wrap-reverse-routing bare-handler)] - (is (= (make-request handler "/succeed") "/user/10")) + (is (= (make-request handler "/succeed") "http://something:8080/user/10")) (is (nil? (make-request handler "/fail1"))) (is (nil? (make-request handler "/fail2")))))) @@ -139,7 +140,7 @@ (GET "/succeed" [] (url-for :get-object "user" 10)) (GET "/fail" [] (url-for :get-object nil 10))) wrap-reverse-routing)] - (is (= (make-request handler "/succeed"), "/user/10")) + (is (= (make-request handler "/succeed"), "http://something:8080/user/10")) (is (nil? (make-request handler "/fail"))))) (deftest context-with-limited-options @@ -154,7 +155,7 @@ (GET "/fail1" [] (url-for :get-object nil 10)) (GET "/fail2" [] (url-for :get-object "person" 10))) wrap-reverse-routing)] - (is (= (make-request handler "/succeed"), "/user/10")) + (is (= (make-request handler "/succeed"), "http://something:8080/user/10")) (is (nil? (make-request handler "/fail1"))) (is (nil? (make-request handler "/fail2"))))) @@ -170,7 +171,7 @@ (GET "/fail2" [] (url-for :user 10 20))) (add-middleware middleware) wrap-reverse-routing)] - (is (= (make-request handler "/succeed") "/user/10")) + (is (= (make-request handler "/succeed") "http://something:8080/user/10")) (is (nil? (make-request handler "/fail1"))) (is (nil? (make-request handler "/fail2"))))) |