|
From: <jgr...@us...> - 2003-08-22 02:10:10
|
Update of /cvsroot/popfile/engine/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv861/tests
Modified Files:
TestHTML.script TestHTML.tst
Log Message:
Added tests for the HTML magnet page
Index: TestHTML.script
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestHTML.script,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** TestHTML.script 22 Aug 2003 00:40:05 -0000 1.9
--- TestHTML.script 22 Aug 2003 02:06:28 -0000 1.10
***************
*** 40,43 ****
--- 40,45 ----
# SETSUBMIT a b Just like doing SETINPUT a b followed by SUBMIT a
# CONFIGIS a b Verify that config item a has value b
+ # MAGNETIS a b c Checks that magnet c exists in bucket a with type b
+ # CLICK a Click the button called a
#
# Expect that the following are available to you within the MATCH/ENDMATCH block
***************
*** 162,173 ****
# TODO Check clearing of individual bucket
! # TODO Magnets Page
! # TODO Check that predefined magnets are presetn
! # TODO Check magnet creation
! # TODO Check magnet change value
! # TODO Check magnet change type
! # TODO Check magnet change bucket
! # TODO Check magnet deletion
# Configuration Page
--- 164,275 ----
# TODO Check clearing of individual bucket
! # Magnets Page
! GET /magnets
!
! # Check that predefined magnets are present
!
! INPUTIS text1 foo
! INPUTIS bucket1 personal
! INPUTIS type1 from
! INPUTIS text2 oldstyle
! INPUTIS bucket2 personal
! INPUTIS type2 from
! INPUTIS text3 bar
! INPUTIS bucket3 personal
! INPUTIS type3 subject
! INPUTIS text4 baz\@baz.com
! INPUTIS bucket4 personal
! INPUTIS type4 to
!
! # Check magnet creation
!
! SETINPUT text0 newmagnet
! SETINPUT type0 subject
! SETSUBMIT bucket0 spam
! INPUTIS text5 newmagnet
! INPUTIS type5 subject
! INPUTIS bucket5 spam
! MAGNETIS spam subject newmagnet
!
! # Check magnet change value
!
! SETSUBMIT text5 newmagnetvalue
! INPUTIS text5 newmagnetvalue
! INPUTIS type5 subject
! INPUTIS bucket5 spam
! MAGNETIS spam subject newmagnetvalue
! INPUTIS text1 foo
! INPUTIS bucket1 personal
! INPUTIS type1 from
! INPUTIS text2 oldstyle
! INPUTIS bucket2 personal
! INPUTIS type2 from
! INPUTIS text3 bar
! INPUTIS bucket3 personal
! INPUTIS type3 subject
! INPUTIS text4 baz\@baz.com
! INPUTIS bucket4 personal
! INPUTIS type4 to
!
! # Check magnet change type
!
! SETSUBMIT type5 to
! INPUTIS type5 to
! INPUTIS text5 newmagnetvalue
! INPUTIS bucket5 spam
! MAGNETIS spam to newmagnetvalue
! INPUTIS text1 foo
! INPUTIS bucket1 personal
! INPUTIS type1 from
! INPUTIS text2 oldstyle
! INPUTIS bucket2 personal
! INPUTIS type2 from
! INPUTIS text3 bar
! INPUTIS bucket3 personal
! INPUTIS type3 subject
! INPUTIS text4 baz\@baz.com
! INPUTIS bucket4 personal
! INPUTIS type4 to
!
! # Check magnet change bucket
!
! SETSUBMIT bucket5 personal
! INPUTIS bucket5 personal
! INPUTIS text5 newmagnetvalue
! INPUTIS type5 to
! MAGNETIS personal to newmagnetvalue
! INPUTIS text1 foo
! INPUTIS bucket1 personal
! INPUTIS type1 from
! INPUTIS text2 oldstyle
! INPUTIS bucket2 personal
! INPUTIS type2 from
! INPUTIS text3 bar
! INPUTIS bucket3 personal
! INPUTIS type3 subject
! INPUTIS text4 baz\@baz.com
! INPUTIS bucket4 personal
! INPUTIS type4 to
!
! # Check magnet deletion
!
! SETINPUT remove5 on
! CLICK delete
! NOTMATCH newmagnetvalue
! NOTMATCH type5
!
! SETINPUT remove1 on
! SETINPUT remove3 on
! CLICK delete
! NOTMATCH "foo"
! NOTMATCH bar
! INPUTIS text1 oldstyle
! INPUTIS bucket1 personal
! INPUTIS type1 from
! INPUTIS text2 baz\@baz.com
! INPUTIS bucket2 personal
! INPUTIS type2 to
! NOTMATCH type3
# Configuration Page
Index: TestHTML.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestHTML.tst,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** TestHTML.tst 22 Aug 2003 00:40:05 -0000 1.13
--- TestHTML.tst 22 Aug 2003 02:06:29 -0000 1.14
***************
*** 206,219 ****
my $command = <$dreader>;
! if ( $command =~ /__QUIT/ ) {
print $uwriter "OK\n";
last;
}
! if ( $command =~ /__GETCONFIG (.+)/ ) {
my $value = $c->parameter( $1 );
print $uwriter "OK $value\n";
next;
}
}
}
--- 206,233 ----
my $command = <$dreader>;
! if ( $command =~ /^__QUIT/ ) {
print $uwriter "OK\n";
last;
}
! if ( $command =~ /^__GETCONFIG (.+)/ ) {
my $value = $c->parameter( $1 );
print $uwriter "OK $value\n";
next;
}
+
+ if ( $command =~ /^__CHECKMAGNET ([^ ]+) ([^ ]+) ([^\r\n]+)/ ) {
+ my $found = 0;
+ for my $magnet ($b->get_magnets( $1, $2 ) ) {
+ if ( $magnet eq $3 ) {
+ print $uwriter "OK\n";
+ $found = 1;
+ last;
+ }
+ }
+
+ print $uwriter "ERR\n" if ( !$found );
+ next;
+ }
}
}
***************
*** 263,266 ****
--- 277,293 ----
}
+ if ( $line =~ /^CLICK +(.+)$/ ) {
+ my $name = $1;
+ my ( $form, $input ) = find_form( $name );
+ my $request = undef;
+ $request = $form->click( $name ) if ( defined( $form ) );
+ if ( defined( $request ) ) {
+ my $response = $ua->request( $request );
+ $content = $response->content;
+ @forms = HTML::Form->parse( $content, "http://127.0.0.1:$port" );
+ }
+ next;
+ }
+
if ( $line =~ /^CONFIGIS +([^ ]+) ?(.+)?$/ ) {
my ( $option, $expected ) = ( $1, $2 );
***************
*** 268,273 ****
print $dwriter "__GETCONFIG $option\n";
my $reply = <$ureader>;
! $reply =~ /^OK (.+)$/;
test_assert_equal( $1, $expected, "From script line $line_number" );
next;
}
--- 295,311 ----
print $dwriter "__GETCONFIG $option\n";
my $reply = <$ureader>;
! $reply =~ /^OK ([^\r\n]+)/;
test_assert_equal( $1, $expected, "From script line $line_number" );
+ next;
+ }
+
+ if ( $line =~ /^MAGNETIS +([^ ]+) ([^ ]+) (.+)$/ ) {
+ my ( $bucket, $type, $magnet ) = ( $1, $2, $3 );
+ print $dwriter "__CHECKMAGNET $bucket $type $magnet\n";
+ my $reply = <$ureader>;
+
+ if ( !( $reply =~ /^OK/ ) ) {
+ test_assert( 0, "From script line $line_number" );
+ }
next;
}
|