mirror of
https://github.com/chatmail/relay.git
synced 2026-05-19 12:28:06 +00:00
better output, and allowing to use the lua script as is
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
|
|
||||||
-- To run this test: run "lua test.lua" while in the same directory as chatctl.py
|
-- To run this test: run "lua test.lua" while in the same directory as chatctl.py
|
||||||
|
|
||||||
dovecot = {
|
if dovecot == nil then
|
||||||
auth = {
|
dovecot = {
|
||||||
PASSDB_RESULT_OK="OK",
|
auth = {
|
||||||
PASSDB_RESULT_PASSWORD_MISMATCH="MISMATCH"
|
PASSDB_RESULT_OK="OK",
|
||||||
|
PASSDB_RESULT_PASSWORD_MISMATCH="MISMATCH"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
end
|
||||||
|
|
||||||
-- Escape shell argument by hex encoding it and wrapping in quotes.
|
-- Escape shell argument by hex encoding it and wrapping in quotes.
|
||||||
function escape(data)
|
function escape(data)
|
||||||
@@ -57,14 +59,15 @@ end
|
|||||||
function test_ok(user, password)
|
function test_ok(user, password)
|
||||||
local res = auth_password_verify({user=user}, password)
|
local res = auth_password_verify({user=user}, password)
|
||||||
assert(res=="OK")
|
assert(res=="OK")
|
||||||
|
print("OK test_ok "..user.." "..password)
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_mismatch(user, password)
|
function test_mismatch(user, password)
|
||||||
local res = auth_password_verify({user=user}, password)
|
local res = auth_password_verify({user=user}, password)
|
||||||
assert(res == "MISMATCH")
|
assert(res == "MISMATCH")
|
||||||
|
print("OK test_mismatch "..user.." "..password)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
test_ok("link2xt@instant2.testrun.org", "Ahyei6ie")
|
test_ok("link2xt@instant2.testrun.org", "Ahyei6ie")
|
||||||
test_mismatch("link2xt@instant2.testrun.org", "Aqwlek")
|
test_mismatch("link2xt@instant2.testrun.org", "Aqwlek")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user