bugfix: short-urls repaired

This commit is contained in:
Christian Mueller
2014-01-19 20:44:18 +01:00
parent 6c5121e865
commit a4aeb34c49
6 changed files with 28 additions and 18 deletions
+8 -1
View File
@@ -45,11 +45,18 @@
(is (= note (:note get-response)))
(is (= (:longURL post-response) (:longURL get-response) note-url))
(is (= (:shortURL post-response) (:shortURL get-response)))
(is (storage/note-exists? (:noteID post-response)))
(let [su (last (clojure.string/split (:shortURL get-response) #"/"))]
(is (= su (storage/create-short-url (storage/resolve-url su)))))
(let [resp (send-request
(clojure.string/replace (:shortURL get-response) domain ""))
resp (send-request ((:headers resp) "Location"))]
(is (substring? "hello world"(:body resp))))
(is (= (:publisher get-response) pid))
(is (= (:title get-response) (derive-title note)))
(is (= "1" (get-in get-response [:statistics :views])))
(isnt (get-in get-response [:statistics :edited]))
(is (= "2" (get-in (get-note (:noteID post-response)) [:statistics :views])))))
(is (= "3" (get-in (get-note (:noteID post-response)) [:statistics :views])))))
(testing "creation with wrong signature"
(let [response (post-note note pid (get-signature pid2 psk note))]
(isnt (:success (:status response)))