48 lines
1.2 KiB
Factor
48 lines
1.2 KiB
Factor
|
|
IN: furnace.auth.providers.db.tests
|
||
|
|
USING: furnace.actions
|
||
|
|
furnace.auth.login
|
||
|
|
furnace.auth.providers
|
||
|
|
furnace.auth.providers.db tools.test
|
||
|
|
namespaces db db.sqlite db.tuples continuations
|
||
|
|
io.files accessors kernel ;
|
||
|
|
|
||
|
|
<action> <login>
|
||
|
|
users-in-db >>users
|
||
|
|
login set
|
||
|
|
|
||
|
|
[ "auth-test.db" temp-file delete-file ] ignore-errors
|
||
|
|
|
||
|
|
"auth-test.db" temp-file sqlite-db [
|
||
|
|
|
||
|
|
init-users-table
|
||
|
|
|
||
|
|
[ t ] [
|
||
|
|
"slava" <user>
|
||
|
|
"foobar" >>encoded-password
|
||
|
|
"slava@factorcode.org" >>email
|
||
|
|
H{ } clone >>profile
|
||
|
|
users new-user
|
||
|
|
username>> "slava" =
|
||
|
|
] unit-test
|
||
|
|
|
||
|
|
[ f ] [
|
||
|
|
"slava" <user>
|
||
|
|
H{ } clone >>profile
|
||
|
|
users new-user
|
||
|
|
] unit-test
|
||
|
|
|
||
|
|
[ f ] [ "fdasf" "slava" check-login >boolean ] unit-test
|
||
|
|
|
||
|
|
[ ] [ "foobar" "slava" check-login "user" set ] unit-test
|
||
|
|
|
||
|
|
[ t ] [ "user" get >boolean ] unit-test
|
||
|
|
|
||
|
|
[ ] [ "user" get "fdasf" >>encoded-password drop ] unit-test
|
||
|
|
|
||
|
|
[ ] [ "user" get users update-user ] unit-test
|
||
|
|
|
||
|
|
[ t ] [ "fdasf" "slava" check-login >boolean ] unit-test
|
||
|
|
|
||
|
|
[ f ] [ "foobar" "slava" check-login >boolean ] unit-test
|
||
|
|
] with-db
|