This commit is contained in:
Christian Mueller
2014-02-02 18:14:03 +01:00
parent 8178d82e67
commit 7608643d52
2 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -66,6 +66,7 @@
(is (= (:title get-response) (derive-title note)))
(is (= "1" (get-in get-response [:statistics :views])))
(isnt (get-in get-response [:statistics :edited]))
(is (= "noteID 'randomString' unknown"(get-in (parse-string (:body (send-request "/api/note" {:version "1.3" :noteID "randomString"}))) ["status" "message"])))
(is (= "3" (get-in (get-note post-response) [:statistics :views])))))
(testing "creation with wrong signature"
(let [response (post-note {:note note :pid pid :signature (storage/sign pid2 psk note)})]
@@ -121,8 +122,8 @@
(is (get-in body ["status" "success"]))
(is (= note ((parse-string
(:body (send-request [:get "/api/note"] {:version "1.0" :noteID noteID}))) "note")))
(is (= "API version expected" ((parse-string
(:body (send-request [:get "/api/note"] {:noteID noteID}))) "message")))
(is (= "API version expected" (get-in (parse-string
(:body (send-request [:get "/api/note"] {:noteID noteID}))) ["status" "message"])))
(is (= note ((parse-string
(:body (send-request [:get "/api/note"] {:version "1.1"
:noteID (clojure.string/replace noteID #"/" " ")}))) "note")))