You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
764 B
31 lines
764 B
1 year ago
|
# shellcheck disable=SC2154,SC2034
|
||
|
|
||
|
testSessionDir='/tmp/exprash_test_sessions'
|
||
|
mkdir -p "$testSessionDir"
|
||
|
|
||
|
it "Should set session directory" "$({
|
||
|
_exprashInit
|
||
|
useSession "$testSessionDir"
|
||
|
[ "$_exprashSessionDir" == "$testSessionDir" ]
|
||
|
})"
|
||
|
|
||
|
it "Should save and load session" "$({
|
||
|
_exprashInit
|
||
|
useSession "$testSessionDir"
|
||
|
session 'data' 'value'
|
||
|
session_id=$_exprashSessionId
|
||
|
cookie_value=${_exprashSetCookies[$_exprashSessionCookieName]}
|
||
|
_exprashShutdown
|
||
|
|
||
|
# Forcibly clear session data just in case (but it should also get cleared by
|
||
|
# _exprashInit)
|
||
|
_exprashSession=()
|
||
|
_exprashSessionId=''
|
||
|
|
||
|
HTTP_COOKIE="${_exprashSessionCookieName}=$cookie_value"
|
||
|
_exprashInit
|
||
|
useSession "$testSessionDir"
|
||
|
[ "$(session 'data')" == "value" ]
|
||
|
})"
|
||
|
|