From: Ian Jackson Date: Wed, 28 Oct 2015 16:37:13 +0000 (+0000) Subject: Testing: autotest: Introduce "loginas" X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=af1635af0c27a27c20e95cc3cbefb55defd363cc;p=cgi-auth-flexible.git Testing: autotest: Introduce "loginas" No functional change. Signed-off-by: Ian Jackson --- diff --git a/tests/autotest b/tests/autotest index a999b32..40d6a57 100755 --- a/tests/autotest +++ b/tests/autotest @@ -53,15 +53,16 @@ proc submitform-expect {wanttxt} { epage $wanttxt } -fillformfield alice -fillformfield bogus -send "\t" -submitform-expect "wrong password" +proc loginas {user {password sesame} {wanttxt ACCESSGRANTED}} { + fillformfield $user + fillformfield $password + send "\t" + submitform-expect $wanttxt +} + +loginas alice bogus "wrong password" -fillformfield alice -fillformfield sesame -send "\t" -submitform-expect "ACCESSGRANTED" +loginas alice etxt {path = '/Tsuffix'} @@ -74,20 +75,15 @@ submitform-expect "You have been logged out" send "B\x10/Make sponges\r" submitform-expect "You need to log in" -fillformfield bob -fillformfield sesame -send "\t" -submitform-expect "ACCESSGRANTED" +loginas bob send "/Logout\r" submitform-expect "You have been logged out" send "/Log in again\r" submitform-expect "need to log in" -fillformfield bob -fillformfield sesame -send "\t" -submitform-expect "ACCESSGRANTED" + +loginas bob send "BBB\x10/Make sponges\r" submitform-expect "Login session interrupted"