chiark / gitweb /
Testing: autotest: Introduce "loginas"
[cgi-auth-flexible.git] / tests / autotest
index a999b3223a6663be3807c8780b588b6144db39d4..40d6a5728a1182b53469f07d7b8cb2c823130733 100755 (executable)
@@ -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"