summaryrefslogtreecommitdiff
path: root/compojure-3.2/test/compojure/http/helpers_test.clj
blob: fdd9a68d6d535c32ffb9726b5d6b29e6aed95604 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(ns compojure.http.helpers-test
  (:use compojure.http.helpers
        compojure.http.routes
        compojure.control
        clojure.contrib.test-is))

(deftest test-set-cookie
  (is (= (set-cookie :foo "bar")
         {:headers {"Set-Cookie" "foo=bar"}})))

(deftest test-set-cookie-path
  (is (= (set-cookie :a "b", :path "/")
         {:headers {"Set-Cookie" "a=b; path=/"}})))

(deftest test-content-type
  (is (= (content-type "text/html")
         {:headers {"Content-Type" "text/html"}})))

(deftest test-safe-path
  (is (not (safe-path? "/basedir/compojure" "../private/secret.txt")))
  (is (safe-path? "/basedir/compojure" "public/index.html")))