Update of /cvsroot/popfile/engine/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10671/tests
Modified Files:
Tag: b0_22_2
TestIMAP.tst
Log Message:
More tests for configure_item()
Index: TestIMAP.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestIMAP.tst,v
retrieving revision 1.3.4.4
retrieving revision 1.3.4.5
diff -C2 -d -r1.3.4.4 -r1.3.4.5
*** TestIMAP.tst 16 Nov 2007 17:06:59 -0000 1.3.4.4
--- TestIMAP.tst 18 Nov 2007 11:39:01 -0000 1.3.4.5
***************
*** 65,69 ****
# First, start POPFile.
my ( $c, $mq, $l, $b, $w, $h ) = start_popfile();
-
my $im = new Services::IMAP;
my $session = $b->get_session_key( 'admin', '' );
--- 65,68 ----
***************
*** 73,79 ****
configure_imap_module( $im, $c, $mq, $l, $b, $h );
test_imap_ui( $im );
! # configure_imap_module( $im, $c, $mq, $l, $b, $h );
! # test_imap_module( $im, $c, $mq, $l, $b, $h );
! # test_imap_client( $im );
$mq->stop();
--- 72,78 ----
configure_imap_module( $im, $c, $mq, $l, $b, $h );
test_imap_ui( $im );
! configure_imap_module( $im, $c, $mq, $l, $b, $h );
! test_imap_module( $im, $c, $mq, $l, $b, $h );
! test_imap_client( $im );
$mq->stop();
***************
*** 498,504 ****
test_assert( $tmpl->param( 'IMAP_if_mailboxes' ) );
! # imap-connection-details.thtml
$tmpl = HTML::Template->new( filename => '../skins/default/imap-bucket-folders.thtml' );
test_assert_equal( $tmpl->query( name => 'IMAP_if_mailboxes' ), 'VAR' );
}
--- 497,535 ----
test_assert( $tmpl->param( 'IMAP_if_mailboxes' ) );
!
! # imap-bucket-folders.thtml
$tmpl = HTML::Template->new( filename => '../skins/default/imap-bucket-folders.thtml' );
test_assert_equal( $tmpl->query( name => 'IMAP_if_mailboxes' ), 'VAR' );
+ $im->{mailboxes__} = [];
+ $im->configure_item( 'imap_3_bucket_folders', $tmpl, $language );
+ test_assert( ! $tmpl->param( 'IMAP_if_mailboxes' ) );
+
+ $im->{mailboxes__} = ['INBOX', 'spam', 'other', 'personal', 'unclassified'];
+ $im->watched_folders__( 'INBOX' );
+
+ $im->configure_item( 'imap_3_bucket_folders', $tmpl, $language );
+ test_assert( $tmpl->param( 'IMAP_if_mailboxes' ) );
+ my $selected = 0;
+ foreach my $record ( @{$tmpl->param('imap_loop_buckets')} ) {
+ $record->{IMAP_Bucket_Header} =~ m|<b>(.+)</b>|;
+ my $bucket = $1;
+ test_assert( $bucket );
+ my $inner_loop = $record->{IMAP_loop_mailboxes};
+ test_assert( $inner_loop );
+ test_assert_equal( ref $inner_loop, 'ARRAY' );
+
+ foreach my $inner_record ( @$inner_loop ) {
+ if ( $inner_record->{IMAP_mailbox} eq $bucket ) {
+ test_assert_equal( $inner_record->{IMAP_selected}, 'selected="selected"' );
+ $selected++;
+ }
+ else {
+ test_assert_equal( $inner_record->{IMAP_selected}, '' );
+ }
+ }
+ }
+ test_assert_equal( $selected, 4 );
+ test_assert_equal( $selected, scalar @{$tmpl->param('imap_loop_buckets')} );
+
}
|