scopes-auth, work in proress: set-up / config tests, start with login
This commit is contained in:
parent
d09abff170
commit
b062ec2962
3 changed files with 53 additions and 6 deletions
|
@ -2,8 +2,12 @@
|
||||||
|
|
||||||
(defpackage :scopes-auth
|
(defpackage :scopes-auth
|
||||||
(:use :common-lisp)
|
(:use :common-lisp)
|
||||||
(:local-nicknames (:dom :scopes/web/dom))
|
(:local-nicknames (:dom :scopes/web/dom)
|
||||||
|
(:util :scopes/util))
|
||||||
(:import-from :scopes/web/dom #:div #:label)
|
(:import-from :scopes/web/dom #:div #:label)
|
||||||
(:export #:login))
|
(:export #:login))
|
||||||
|
|
||||||
(in-package :scopes-auth)
|
(in-package :scopes-auth)
|
||||||
|
|
||||||
|
(defun login (cred)
|
||||||
|
(util:lgi cred))
|
||||||
|
|
29
lib/auth/test/config.lisp
Normal file
29
lib/auth/test/config.lisp
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
;;;; cl-scopes/lib/auth/test/config
|
||||||
|
;;;; use: `(let ((t:*current-system* :scopes-auth) ...)
|
||||||
|
;;;; `(load (t:test-path "config" "")))`
|
||||||
|
;;;; from scopes-auth/test
|
||||||
|
|
||||||
|
(in-package :scopes-auth/test)
|
||||||
|
|
||||||
|
(config:root :env-keys
|
||||||
|
'(:address :port
|
||||||
|
:db-name :db-user :db-password))
|
||||||
|
|
||||||
|
(config:add :logger :class 'logging:config
|
||||||
|
:loglevel :info
|
||||||
|
:logfile (t:test-path "scopes-test.log" "log")
|
||||||
|
:console nil)
|
||||||
|
|
||||||
|
(config:add :server
|
||||||
|
:class 'server:config
|
||||||
|
:port "8899"
|
||||||
|
:routes
|
||||||
|
`((("hx") server:message-handler :html-responder cs-hx:response)
|
||||||
|
(() server:fileserver
|
||||||
|
:doc-root ,(t:test-path "" "docs"))))
|
||||||
|
(config:add-action '(:auth :login) #'auth:login)
|
||||||
|
|
||||||
|
(config:add :client
|
||||||
|
:class 'client:config
|
||||||
|
:base-url "http://localhost:8899"
|
||||||
|
:doc-path "/" :api-path "/hx/")
|
|
@ -3,7 +3,13 @@
|
||||||
(defpackage :scopes-auth/test
|
(defpackage :scopes-auth/test
|
||||||
(:use :common-lisp)
|
(:use :common-lisp)
|
||||||
(:local-nicknames (:auth :scopes-auth)
|
(:local-nicknames (:auth :scopes-auth)
|
||||||
(:t :scopes/testing))
|
(:client :scopes/web/client)
|
||||||
|
(:config :scopes/config)
|
||||||
|
(:core :scopes/core)
|
||||||
|
(:cs-hx :scopes/frontend/cs-hx)
|
||||||
|
(:logging :scopes/logging)
|
||||||
|
(:server :scopes/web/server)
|
||||||
|
(:t :scopes/testing))
|
||||||
(:import-from :scopes/testing #:deftest #:==)
|
(:import-from :scopes/testing #:deftest #:==)
|
||||||
(:export #:run))
|
(:export #:run))
|
||||||
|
|
||||||
|
@ -12,10 +18,18 @@
|
||||||
;;;; test runner
|
;;;; test runner
|
||||||
|
|
||||||
(defun run ()
|
(defun run ()
|
||||||
(let ((t:*test-suite* (t:test-suite "auth")))
|
(let ((t:*current-system* :scopes-auth)
|
||||||
|
(t:*test-suite* (t:test-suite "auth")))
|
||||||
|
(load (t:test-path "config" ""))
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
(progn
|
(progn
|
||||||
(test-login))
|
(core:setup-services)
|
||||||
(t:show-result))))
|
(let ((server (core:find-service :server))
|
||||||
|
(client (core:find-service :client)))
|
||||||
|
(test-login))
|
||||||
|
(t:show-result)))))
|
||||||
|
|
||||||
(deftest test-login ())
|
(deftest test-login ()
|
||||||
|
(let ((cred '(:login "admin" :password "secret")))
|
||||||
|
(auth:login cred)
|
||||||
|
))
|
||||||
|
|
Loading…
Add table
Reference in a new issue