subroutine ProfileTest *************************************************************************** * ProfileTest: Test the w3ProfileDelete, w3ProfileExpire, and w3ProfileGet * using the timeout period. *************************************************************************** include wbp w3Include * [00] 10Mar00 jr Initial creation * set up data open "w3Profile" to f.profile else stop 201, "w3Profile" open "w3Apps" to f.apps else stop 201, "w3Apps" |
open "w3Users" to f.user else stop 201, "w3user" w3Id = "TestId" w3Ap = "ProfileTest" w3Us = "jack" * create w3User for testing item = "ProfileTest user" item<7> = oconv("roth", "u3060") write item on f.user, w3Us * create w3ProfileId for testing item = w3Ap |
item<2> = w3us item<3> = oconv("roth","u3060") ;* encrypt password item<4> = time() item<5> = date() item<6> = time() item<7> = date() write item on f.profile, w3Id
* create w3Apps item for testing item = "Y" |
item<7> = "y" item<10> = 1 write item on f.apps, w3Ap call w3HtmlInit("","") subs = "##TITLE##":@vm:"w3ProfileTests" subs<-1> = "##HEADLINE##":@vm:"w3ProfileTests" call w3HtmlHeader("", subs) call w3Printn("<H2>test1, adding an entry</H2>") CRT "Test 1: adding an entry" call w3ProfileUpdate(w3Id, w3Ap, w3us, "roth") |
passwordStatus = "" call w3ProfileExtract(w3Id, w3Ap, w3Us, passwordStatus)
if passwordStatus = 0 then ;* 0 = invalid password call w3Printn("<P>Test failed") CRT "Test 1 failed" end else call w3Printn("<P>Test passed") CRT "Test 1 passed" end call w3Printn("<H2>test2, Entry Expire</H2>") |
CRT "Test 2: w3ProfileExpire" * add the entry back in call w3ProfileUpdate(w3Id, w3Ap, w3us, "roth") call w3ProfileExpire(w3Id, w3Ap) passwordStatus = "" call w3ProfileExtract(w3Id, w3Ap, w3Us, passwordStatus)
if passwordStatus # 0 then call w3Printn("<P>Test failed") CRT "Test 2 failed" |
end else call w3Printn("<P>Test passed") CRT "Test 2 passed" end call w3Printn("<H2>test3, Entry timeout</H2>") CRT "Test 3: Entry timeout" CRT "Test 3 waiting for timeout period to pass" sleep(120) ;* password timesout in 1 minute, wait for 2 passwordStatus = "" call w3ProfileExtract(w3Id, w3Ap, w3Us, passwordStatus)
|
if passwordStatus # 0 then call w3Printn("<P>Test failed") CRT "Test 3 failed" end else call w3Printn("<P>Test passed") CRT "Test 3 passed" end
call w3Printn("<H2>test4, Entry Delete</H2>") CRT "Test 4: w3ProfileDelete" |
* add the entry back in call w3ProfileUpdate(w3Id, w3Ap, w3us, "roth") call w3ProfileDelete(w3Id, w3Ap) passwordStatus = "" call w3ProfileExtract(w3Id, w3Ap, w3Us, passwordStatus)
if passwordStatus # 0 then call w3Printn("<P>Test failed") CRT "Test 4 failed" end else call w3Printn("<P>Test passed") |
CRT "Test 4 passed" end call w3HtmlFooter("", "") delete f.profile, w3Id delete f.user, w3Us return |