tests extended
This commit is contained in:
@@ -8,3 +8,4 @@ pom.xml
|
|||||||
.lein-*
|
.lein-*
|
||||||
.crossover-cljs
|
.crossover-cljs
|
||||||
target/
|
target/
|
||||||
|
.nrepl-port
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
(defn get-note-statistics
|
(defn get-note-statistics
|
||||||
"Return views, publishing and editing timestamp"
|
"Return views, publishing and editing timestamp"
|
||||||
[noteID]
|
[noteID]
|
||||||
{ :view (redis/hget db views noteID)
|
{ :views (redis/hget db views noteID)
|
||||||
:published (redis/hget db published noteID)
|
:published (redis/hget db published noteID)
|
||||||
:edited (redis/hget db edited noteID) })
|
:edited (redis/hget db edited noteID) })
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,10 @@
|
|||||||
(is (:success (:status get-response)))
|
(is (:success (:status get-response)))
|
||||||
(is (= note (:note get-response)))
|
(is (= note (:note get-response)))
|
||||||
(is (= (:longURL post-response) (:longURL get-response) note-url))
|
(is (= (:longURL post-response) (:longURL get-response) note-url))
|
||||||
(is (= (:shortURL post-response) (:shortURL get-response)))))
|
(is (= (:shortURL post-response) (:shortURL get-response)))
|
||||||
|
(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])))))
|
||||||
(testing "creation with wrong signature"
|
(testing "creation with wrong signature"
|
||||||
(let [response (post-note note pid (get-signature pid2 psk note))]
|
(let [response (post-note note pid (get-signature pid2 psk note))]
|
||||||
(isnt (:success (:status response)))
|
(isnt (:success (:status response)))
|
||||||
@@ -71,6 +74,7 @@
|
|||||||
(let [update-response (update-note note-id new-note pid
|
(let [update-response (update-note note-id new-note pid
|
||||||
(get-signature pid psk note-id new-note "passwd") "passwd")]
|
(get-signature pid psk note-id new-note "passwd") "passwd")]
|
||||||
(is (= { :success true } (:status update-response)))
|
(is (= { :success true } (:status update-response)))
|
||||||
|
(isnt (= nil (get-in (get-note note-id) [:statistics :edited])))
|
||||||
(is (= new-note (:note (get-note note-id)))))
|
(is (= new-note (:note (get-note note-id)))))
|
||||||
(let [update-response (update-note note-id "aaa" pid
|
(let [update-response (update-note note-id "aaa" pid
|
||||||
(get-signature pid psk note-id "aaa" "pass") "pass")]
|
(get-signature pid psk note-id "aaa" "pass") "pass")]
|
||||||
|
|||||||
Reference in New Issue
Block a user