? tools/test/StoreTest.pm ? tools/test/TestTemplates.pm Index: tools/test/script_tests/README =================================================================== RCS file: /cvsroot/twiki/twiki/tools/test/script_tests/README,v retrieving revision 1.1 diff -u -r1.1 README --- tools/test/script_tests/README 11 Apr 2004 13:49:40 -0000 1.1 +++ tools/test/script_tests/README 13 Apr 2004 18:49:04 -0000 @@ -9,7 +9,7 @@ Note that as of April 2004 the script tests are very naive; many of them are little more than compile and compare tests. All the scripts need more sophisticated testing of their various parameters. -The CGIScriptSuite is run with the command: +The CGIScriptSuite is configured in the ScriptTestFixture.pm file and run with the command: perl TestRunner.pl CGIScriptSuite.pm Index: tools/test/script_tests/uploadScriptTest.pm =================================================================== RCS file: /cvsroot/twiki/twiki/tools/test/script_tests/uploadScriptTest.pm,v retrieving revision 1.1 diff -u -r1.1 uploadScriptTest.pm --- tools/test/script_tests/uploadScriptTest.pm 11 Apr 2004 05:27:04 -0000 1.1 +++ tools/test/script_tests/uploadScriptTest.pm 13 Apr 2004 18:49:04 -0000 @@ -34,15 +34,21 @@ return $self; } -sub set_up { +sub createOldFixture { my $this = shift; - $this->SUPER::set_up(); + $this->createTempForUpload(); + my $text = "Pugh,Pugh,Barney%20McGrew,Cuthbert,Dibble,Grubb"; + $this->getOld("save", $web, $topic, "text=$text&unlock=on"); +} + +sub createNewFixture { + my $this = shift; + $this->createTempForUpload(); my $text = "Pugh,Pugh,Barney%20McGrew,Cuthbert,Dibble,Grubb"; - # Save in both old and new - $this->compareOldAndNew("save", $web, $topic, "text=$text&unlock=on"); + $this->getNew("save", $web, $topic, "text=$text&unlock=on"); } -sub tear_down { +sub deleteFixture { my $this = shift; $this->SUPER::tear_down(); # clean up fixture @@ -52,14 +58,62 @@ sub test_simple { my $this = shift; - $this->createTempForUpload(); + $this->createOldFixture(); my $old = $this->getOld("upload", $web, $topic, "filepath=/tmp/robot.gif&filecomment=Arrrrgh&createlink=on&noredirect=on"); + $this->deleteFixture(); - $this->createTempForUpload(); + $this->createNewFixture(); my $new = $this->getNew("upload", $web, $topic, "filepath=/tmp/robot.gif&filecomment=Arrrrgh&createlink=on&noredirect=on"); + $this->deleteFixture(); + + $this->diff($old, $new); +} + +sub test_badweb { + my $this = shift; + + $this->createOldFixture(); + my $old = $this->getOld("upload", "Spogarog", $topic, "filepath=/tmp/robot.gif&filecomment=Arrrrgh&createlink=on&noredirect=on"); + $this->deleteFixture(); + + $this->createNewFixture(); + my $new = $this->getNew("upload", "Spogarog", $topic, "filepath=/tmp/robot.gif&filecomment=Arrrrgh&createlink=on&noredirect=on"); + $this->deleteFixture(); $this->diff($old, $new); } + +sub test_badtopic { + my $this = shift; + + $this->createOldFixture(); + my $old = $this->getOld("upload", $web, "Spogarog", "filepath=/tmp/robot.gif&filecomment=Arrrrgh&createlink=on&noredirect=on"); + $this->deleteFixture(); + + $this->createNewFixture(); + my $new = $this->getNew("upload", $web, "Spogarog", "filepath=/tmp/robot.gif&filecomment=Arrrrgh&createlink=on&noredirect=on"); + $this->deleteFixture(); + + $this->diff($old, $new); +} + +sub test_missing_upload { + my $this = shift; + + $this->createOldFixture(); + my $old = $this->getOld("upload", $web, $topic, "filepath=/dev/scream.gif&filecomment=Arrrrgh&createlink=on&noredirect=on"); + $this->deleteFixture(); + + $this->createNewFixture(); + my $new = $this->getNew("upload", $web, $topic, "filepath=/dev/scream.gif&filecomment=Arrrrgh&createlink=on&noredirect=on"); + $this->deleteFixture(); + + $this->diff($old, $new); +} + +#sub test_size_limit { +# my $this = shift; +#} # Should test other parameters