Add tests for Lack.Session.Store.Redis.

This commit is contained in:
Eitaro Fukamachi 2016-02-09 22:50:40 +09:00
parent 6a07817137
commit 524f4c3fe1

View file

@ -104,11 +104,23 @@
(let ((body (nth 2 (funcall app (generate-env "/" :cookies `(("lack.session" . ,session)))))))
(is body '("Hello, 深町英太郎! You've been here for 2th times!")))
(sleep 2)
(let ((body (nth 2 (funcall app (generate-env "/" :cookies `(("lack.session" . ,session)))))))
(is body '("Hello, 深町英太郎! You've been here for 3th times!")
"Still the session is alive"))
(sleep 2)
(let ((body (nth 2 (funcall app (generate-env "/" :cookies `(("lack.session" . ,session)))))))
(is body '("Hello, 深町英太郎! You've been here for 4th times!")
"Reset the expiration when accessed"))
(sleep 3)
(let ((body (nth 2 (funcall app (generate-env "/" :cookies `(("lack.session" . ,session)))))))
(is body '("Hello, 深町英太郎! You've been here for 1th times!")
"Session has expired after 3 seconds"))))
"Session has expired after 3 seconds since the last access"))))
(let ((redis::*connection* *connection*))
(is (length (red:keys (format nil "~A:*" *namespace*)))