64 lines
1.9 KiB
Common Lisp
64 lines
1.9 KiB
Common Lisp
|
;;;; tests/users.lisp
|
||
|
|
||
|
(in-package :cl-deck-builder2-test)
|
||
|
|
||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||
|
;; USER Tests
|
||
|
|
||
|
;; (defparameter *user*
|
||
|
;; (make-user :username "batman" :password "robin"))
|
||
|
|
||
|
;; So much to be done.
|
||
|
;; TODO test find-user
|
||
|
;; TODO test list-users
|
||
|
;; TODO test sxql create drop alter table
|
||
|
;; TODO test csv-import
|
||
|
;; TODO test card merging
|
||
|
;; TODO test card modification
|
||
|
;; TODO test card diff
|
||
|
|
||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||
|
(defparameter *user-names*
|
||
|
'("Mary" "John" "Joseph" "James" "Jordan" "Armaan" "Amaranth" "Sheldon"
|
||
|
"Amy" "Lisa" "Bart" "Homer" "Sheila" "Tony Hawk" "Blanket"
|
||
|
"Michael Jackson" "Gary" "Spongebob" "Squidward" "Tentacles" "Anime"
|
||
|
"BLT" "Subway" "Shiitake" "Psilocybin" "Psilocilin" "Magician"
|
||
|
"Dark Magician" "Dark Magician of Chaos" "Buster Blader"
|
||
|
"M. Night Shamalyan" "Drake" "Josh" "Meghan"))
|
||
|
|
||
|
(defparameter *user-emails*
|
||
|
'("email@example.com"
|
||
|
"yahoo@gmail.com"
|
||
|
"fake@email.com"
|
||
|
"nope@nobody.net"
|
||
|
"install@gentoo.org"
|
||
|
"smartypants@uni.edu"
|
||
|
"FBI@CIA.GOV"))
|
||
|
|
||
|
(defun populate-table-users ()
|
||
|
(user-table-ensure-exists)
|
||
|
|
||
|
(dolist (user-name *user-names*)
|
||
|
(user-create
|
||
|
:username user-name
|
||
|
:password "a"
|
||
|
:email (alexandria:random-elt *user-emails*))))
|
||
|
|
||
|
(defparameter *user* (make-instance 'user
|
||
|
:username (alexandria:random-elt *user-names*)
|
||
|
:password "test"
|
||
|
:email (alexandria:random-elt *user-emails*)))
|
||
|
|
||
|
(is (member (user-username-of *user*) *user-emails* :test #'string=)
|
||
|
t)
|
||
|
|
||
|
;; (is (user-valid-p *user*) t)
|
||
|
|
||
|
;; (is (user-password-of *user*) "test")
|
||
|
|
||
|
;; (user-hash-password *user*)
|
||
|
|
||
|
;; ISNT? As in, "is not"? Maybe there's a better way to do this. I'd
|
||
|
;; like to check if the string starts with PKBDF whatever nonsense.
|
||
|
(isnt (user-password-of *user*) "test")
|