|
|
|
@ -4,8 +4,6 @@ |
|
|
|
(:use [NoteHub.api] |
|
|
|
(:use [NoteHub.api] |
|
|
|
[clojure.test])) |
|
|
|
[clojure.test])) |
|
|
|
|
|
|
|
|
|
|
|
(def note "Hello world, this is a test note!") |
|
|
|
|
|
|
|
(def note2 "Another test note") |
|
|
|
|
|
|
|
(def pid "somePlugin") |
|
|
|
(def pid "somePlugin") |
|
|
|
(def pid2 "somePlugin2") |
|
|
|
(def pid2 "somePlugin2") |
|
|
|
|
|
|
|
|
|
|
|
@ -14,16 +12,20 @@ |
|
|
|
(defn register-publisher-fixture [f] |
|
|
|
(defn register-publisher-fixture [f] |
|
|
|
(def psk (storage/register-publisher pid)) |
|
|
|
(def psk (storage/register-publisher pid)) |
|
|
|
(f) |
|
|
|
(f) |
|
|
|
(storage/revoke-publisher pid)) |
|
|
|
(storage/revoke-publisher pid) |
|
|
|
|
|
|
|
(storage/revoke-publisher pid2)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-fixtures :each register-publisher-fixture) |
|
|
|
|
|
|
|
|
|
|
|
(deftest api |
|
|
|
(deftest api |
|
|
|
(testing "API" |
|
|
|
(testing "API" |
|
|
|
(testing "publisher registration" |
|
|
|
(testing "publisher registration" |
|
|
|
(let [psk2 (storage/register-publisher pid2)] |
|
|
|
|
|
|
|
(is (storage/valid-publisher? pid)) |
|
|
|
(is (storage/valid-publisher? pid)) |
|
|
|
|
|
|
|
(isnt (storage/valid-publisher? pid2)) |
|
|
|
|
|
|
|
(let [psk2 (storage/register-publisher pid2)] |
|
|
|
|
|
|
|
(is (= psk2 (storage/get-psk pid2))) |
|
|
|
(is (storage/valid-publisher? pid2)) |
|
|
|
(is (storage/valid-publisher? pid2)) |
|
|
|
(is (storage/revoke-publisher pid2)) |
|
|
|
(is (storage/revoke-publisher pid2)) |
|
|
|
(isnt (storage/revoke-publisher "anyPID")) |
|
|
|
|
|
|
|
(isnt (storage/valid-publisher? "any_PID")) |
|
|
|
(isnt (storage/valid-publisher? "any_PID")) |
|
|
|
(isnt (storage/valid-publisher? pid2)))) |
|
|
|
(isnt (storage/valid-publisher? pid2)))) |
|
|
|
#_ (testing "note publishing & retrieval" |
|
|
|
#_ (testing "note publishing & retrieval" |
|
|
|
|