Commit 83dbe283 authored by Johannes Knödtel's avatar Johannes Knödtel 🎶
Browse files

add test cases for session locking

parent 5d6041df
......@@ -321,10 +321,49 @@
session-1 (second (first (db/create-session<! @connection {:name "Test Session 1"})))]
(is (= (db/get-sessions @connection {})
(list {:id ,session-1
:name "Test Session 1"})))
:name "Test Session 1"
:locked false})))
(let [session-2 (second (first (db/create-session<! @connection {:name "Test Session 2"})))]
(is (= (db/get-sessions @connection {})
(list {:id session-2
:name "Test Session 2"}
:name "Test Session 2"
:locked false}
{:id session-1
:name "Test Session 1"}))))))
:name "Test Session 1"
:locked false})))
(db/lock-session! @connection {:session session-2})
(is (= (db/session-locked? @connection {:session session-1})
{:locked false}))
(is (= (db/session-locked? @connection {:session session-2})
{:locked true}))
(is (= (db/get-sessions @connection {})
(list {:id session-2
:name "Test Session 2"
:locked true}
{:id session-1
:name "Test Session 1"
:locked false})))
(db/unlock-session! @connection {:session session-1})
(is (= (db/session-locked? @connection {:session session-1})
{:locked false}))
(is (= (db/session-locked? @connection {:session session-2})
{:locked true}))
(is (= (db/get-sessions @connection {})
(list {:id session-2
:name "Test Session 2"
:locked true}
{:id session-1
:name "Test Session 1"
:locked false})))
(db/unlock-session! @connection {:session session-2})
(is (= (db/session-locked? @connection {:session session-1})
{:locked false}))
(is (= (db/session-locked? @connection {:session session-2})
{:locked false}))
(is (= (db/get-sessions @connection {})
(list {:id session-2
:name "Test Session 2"
:locked false}
{:id session-1
:name "Test Session 1"
:locked false}))))))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment