|
|
|
@ -32,38 +32,39 @@ |
|
|
|
(is (= metadata (resolve-url url))) |
|
|
|
(is (= metadata (resolve-url url))) |
|
|
|
(delete-short-url url) |
|
|
|
(delete-short-url url) |
|
|
|
(is (not (short-url-exists? url)))))) |
|
|
|
(is (not (short-url-exists? url)))))) |
|
|
|
(testing "of correct note creation" |
|
|
|
(testing "of correct note creation" |
|
|
|
(is (= (do |
|
|
|
(is (= (let [note-id (build-key date test-title)] |
|
|
|
(add-note (build-key date test-title) test-note "testPID") |
|
|
|
(add-note note-id test-note "testPID") |
|
|
|
(is (= 2 (redis :scard (str (build-key date test-title) :urls)))) |
|
|
|
(is (= 2 (redis :scard (str note-id :urls)))) |
|
|
|
(create-short-url (build-key date test-title) metadata) |
|
|
|
(create-short-url note-id metadata) |
|
|
|
(is (= 3 (redis :scard (str (build-key date test-title) :urls)))) |
|
|
|
(is (= 3 (redis :scard (str note-id :urls)))) |
|
|
|
(get-note (build-key date test-title))) |
|
|
|
(increment-note-view note-id) |
|
|
|
test-note)) |
|
|
|
(get-note note-id)) |
|
|
|
(is (= "1" (get-note-views (build-key date test-title)))) |
|
|
|
test-note)) |
|
|
|
(is (= (do |
|
|
|
(is (= "1" (get-note-views (build-key date test-title)))) |
|
|
|
(get-note (build-key date test-title)) |
|
|
|
(is (= (do |
|
|
|
(get-note-views (build-key date test-title))) |
|
|
|
(increment-note-view (build-key date test-title)) |
|
|
|
"2"))) |
|
|
|
(get-note-views (build-key date test-title))) |
|
|
|
(testing "of note update" |
|
|
|
"2"))) |
|
|
|
(is (= (do |
|
|
|
(testing "of note update" |
|
|
|
(add-note (build-key date test-title) test-note "testPID" "12345qwert") |
|
|
|
(is (= (do |
|
|
|
(get-note (build-key date test-title))) |
|
|
|
(add-note (build-key date test-title) test-note "testPID" "12345qwert") |
|
|
|
test-note)) |
|
|
|
(get-note (build-key date test-title))) |
|
|
|
(is (valid-password? (build-key date test-title) "12345qwert")) |
|
|
|
test-note)) |
|
|
|
(is (= (do |
|
|
|
(is (valid-password? (build-key date test-title) "12345qwert")) |
|
|
|
(edit-note (build-key date test-title) "update") |
|
|
|
(is (= (do |
|
|
|
(get-note (build-key date test-title))) |
|
|
|
(edit-note (build-key date test-title) "update") |
|
|
|
"update"))) |
|
|
|
(get-note (build-key date test-title))) |
|
|
|
(testing "of the note access" |
|
|
|
"update"))) |
|
|
|
(is (not= (get-note (build-key date test-title)) "any text"))) |
|
|
|
(testing "of the note access" |
|
|
|
(testing "of note existence" |
|
|
|
(is (not= (get-note (build-key date test-title)) "any text"))) |
|
|
|
(is (note-exists? (build-key date test-title))) |
|
|
|
(testing "of note existence" |
|
|
|
(is (short-url-exists? test-short-url)) |
|
|
|
(is (note-exists? (build-key date test-title))) |
|
|
|
(is (= 3 (redis :scard (str (build-key date test-title) :urls)))) |
|
|
|
(is (short-url-exists? test-short-url)) |
|
|
|
(delete-note (build-key date test-title)) |
|
|
|
(is (= 3 (redis :scard (str (build-key date test-title) :urls)))) |
|
|
|
(is (not (short-url-exists? test-short-url))) |
|
|
|
(delete-note (build-key date test-title)) |
|
|
|
(is (not (note-exists? (build-key date test-title)))) |
|
|
|
(is (not (short-url-exists? test-short-url))) |
|
|
|
(is (= 0 (redis :scard (str (build-key date test-title) :urls)))) |
|
|
|
(is (not (note-exists? (build-key date test-title)))) |
|
|
|
(is (not (note-exists? (build-key [2013 06 03] test-title)))) |
|
|
|
(is (= 0 (redis :scard (str (build-key date test-title) :urls)))) |
|
|
|
(is (not (note-exists? (build-key date "some title")))))) |
|
|
|
(is (not (note-exists? (build-key [2013 06 03] test-title)))) |
|
|
|
|
|
|
|
(is (not (note-exists? (build-key date "some title")))))) |
|
|
|
|