X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;ds=sidebyside;f=tests%2Fautotest;h=2fc09861f54d641339e013b57e9c0169391810d9;hb=61f3391ccbc80f515eb7210cc87e314b7058b05f;hp=0d84c63ffa91934d15bb384beb0c5714e85a7c46;hpb=2e563cd36382e353a3ce9326c104b22f61f7cf4a;p=cgi-auth-flexible.git diff --git a/tests/autotest b/tests/autotest index 0d84c63..2fc0986 100755 --- a/tests/autotest +++ b/tests/autotest @@ -1,5 +1,7 @@ #!/usr/bin/expect -f +set testfile [lindex $argv 0] + set tt tests/tmp exec rm -rf $tt @@ -10,18 +12,17 @@ set pwd [pwd] set env(HOME) $tt set env(CAFTEST_CAF) $pwd set env(TERM) vt100 +set env(CAFTEST_NOSRCDUMP) 1 +set env(LC_ALL) en_GB.utf-8 log_user 0 log_file -a $tt/expect.log -spawn -nottycopy \ -w3m -config /dev/null -o cgi_bin=$pwd/tests file:///cgi-bin/wrap - proc timeout-abort {} { send_log "\r\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" error "aborting due to timeout" } -set timeout 5 +set timeout 15 expect_after timeout timeout-abort @@ -37,11 +38,36 @@ proc etxt {str} { elog -re $str } -etxt {You need to log in} -etxt {Source available} +proc epage {str} { + etxt $str +} + +proc dospawn {} { + global pwd spawn_id + + spawn -nottycopy \ + w3m -config /dev/null -o cgi_bin=$pwd/tests file:///cgi-bin/wrap/Tsuffix + + epage {You need to log in} +} + +proc fillformfield {value} { + send "\t\r$value\r" +} + +proc submitform-expect {wanttxt} { + send "\r" + etxt "loading file" + epage $wanttxt +} + +proc loginas {user {password sesame} {wanttxt ACCESSGRANTED}} { + fillformfield $user + fillformfield $password + send "\t" + submitform-expect $wanttxt +} -send "\t\ralice\r\t\rbogus\r\t\r" -etxt "loading file" -etxt "wrong password" +source $testfile puts ok