auth/web: start with testing client login
This commit is contained in:
parent
b4fc8ad05d
commit
b264886c17
5 changed files with 19 additions and 9 deletions
|
@ -6,8 +6,7 @@
|
|||
:version "0.0.1"
|
||||
:homepage "https://www.cyberconcepts.org"
|
||||
:description "Authentication services"
|
||||
:depends-on (:scopes
|
||||
:flexi-streams :ironclad :qbase64)
|
||||
:depends-on (:scopes)
|
||||
:components ((:file "auth")
|
||||
(:file "web" :depends-on ("auth")))
|
||||
:long-description "scopes framework: authentication services."
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
`((("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-action '(:auth :login) #'web:login)
|
||||
|
||||
(config:add :client :class 'client:config
|
||||
:base-url "http://localhost:8899"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
(:core :scopes/core)
|
||||
(:cs-hx :scopes/frontend/cs-hx)
|
||||
(:logging :scopes/logging)
|
||||
(:message :scopes/core/message)
|
||||
(:server :scopes/web/server)
|
||||
(:shape :scopes/shape)
|
||||
(:t :scopes/testing))
|
||||
|
@ -28,7 +29,9 @@
|
|||
(core:setup-services)
|
||||
(let ((server (core:find-service :server))
|
||||
(client (core:find-service :client)))
|
||||
(test-login)))
|
||||
(sleep 0.1)
|
||||
(test-login)
|
||||
(test-client client)))
|
||||
(core:shutdown)
|
||||
(t:show-result))))
|
||||
|
||||
|
@ -38,5 +41,10 @@
|
|||
(== (auth:login cred) nil)
|
||||
(setf cred '(:name "admin" :password "sc0pes"))
|
||||
(setf pr1 (auth:login cred))
|
||||
(== (shape:head-value pr1 :name) :admin)
|
||||
))
|
||||
(== (shape:head-value pr1 :name) :admin)))
|
||||
|
||||
(deftest test-client (client)
|
||||
(let ((msg (message:create
|
||||
'(:auth :login)
|
||||
:data '(:name "admin" :password "sc0pes"))))
|
||||
(client:send-message client msg)))
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
(defpackage :scopes-auth/web
|
||||
(:use :common-lisp)
|
||||
(:local-nicknames (:auth :scopes-auth)
|
||||
(:config :scopes/config))
|
||||
(:config :scopes/config)
|
||||
(:core :scopes/core))
|
||||
(:export #:login))
|
||||
|
||||
(in-package :scopes-auth/web)
|
||||
|
||||
|
||||
(defun login (ctx msg)
|
||||
(core:echo ctx msg))
|
||||
|
|
|
@ -72,7 +72,8 @@
|
|||
"<div><div><label>info</label>: test data</div></div>")) ; cs-hx:response
|
||||
;"<dl><dt>info</dt><dd>test data</dd></dl>"))) ; default response
|
||||
(let ((msg (message:create '(:test :cookie)
|
||||
:data '(:name "mycookie" :value "my_value"))))
|
||||
:data '(:name "mycookie" :value "my_value"
|
||||
:domain "localhost"))))
|
||||
(client:send-message client msg)
|
||||
(util:lgi client::*cookie-jar*))
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue