From 4ba5cd0ce3caf11a2a1f1772cdb33c105ee86b4a Mon Sep 17 00:00:00 2001 From: holger krekel Date: Thu, 12 Oct 2023 17:23:33 +0200 Subject: [PATCH] better output, and allowing to use the lua script as is --- src/chatmail/chatctl/test.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/chatmail/chatctl/test.lua b/src/chatmail/chatctl/test.lua index a1e1f051..bfa399c8 100644 --- a/src/chatmail/chatctl/test.lua +++ b/src/chatmail/chatctl/test.lua @@ -1,12 +1,14 @@ -- To run this test: run "lua test.lua" while in the same directory as chatctl.py -dovecot = { - auth = { - PASSDB_RESULT_OK="OK", - PASSDB_RESULT_PASSWORD_MISMATCH="MISMATCH" +if dovecot == nil then + dovecot = { + auth = { + PASSDB_RESULT_OK="OK", + PASSDB_RESULT_PASSWORD_MISMATCH="MISMATCH" + } } -} +end -- Escape shell argument by hex encoding it and wrapping in quotes. function escape(data) @@ -57,14 +59,15 @@ end function test_ok(user, password) local res = auth_password_verify({user=user}, password) assert(res=="OK") + print("OK test_ok "..user.." "..password) end function test_mismatch(user, password) local res = auth_password_verify({user=user}, password) assert(res == "MISMATCH") + print("OK test_mismatch "..user.." "..password) end - test_ok("link2xt@instant2.testrun.org", "Ahyei6ie") test_mismatch("link2xt@instant2.testrun.org", "Aqwlek")