- Timestamp:
- 12/13/08 16:58:36 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MailInContrib/test/unit/MailInContrib/MailInContribSuite.pm
r1064 r1323 2 2 3 3 package MailInContribSuite; 4 5 use base qw( FoswikiFnTestCase! ); 6 7 use TWiki; 4 use base 'FoswikiFnTestCase'; 5 6 use Foswiki; 8 7 use Error qw( :try ); 9 8 use File::Path; 10 9 use Error qw( :try ); 11 use TWiki::Contrib::MailInContrib;10 use Foswiki::Contrib::MailInContrib; 12 11 13 12 my $box; … … 23 22 $this->{twiki}->{store}->createWeb( 24 23 $this->{twiki}->{user}, $this->{system_web}, 25 $TWiki::cfg{SystemWebName} ); 24 $Foswiki::cfg{SystemWebName} ); 25 my $adm = Foswiki::Func::getCanonicalUserID( 26 $Foswiki::cfg{AdminUserWikiName}); 26 27 $this->{twiki}->{store}->saveTopic( 27 $ TWiki::cfg{AdminUserWikiName}, $this->{system_web},28 $adm, $this->{system_web}, 28 29 'WebPreferences', ""); 29 30 30 $ TWiki::cfg{SystemWebName} = $this->{system_web};31 $Foswiki::cfg{SystemWebName} = $this->{system_web}; 31 32 32 33 $this->{twiki}->finish(); 33 $this->{twiki} = new TWiki();34 35 my $workdir = TWiki::Func::getWorkArea('MailInContrib');34 $this->{twiki} = new Foswiki(); 35 36 my $workdir = Foswiki::Func::getWorkArea('MailInContrib'); 36 37 open(F, ">$workdir/timestamp") || die $!; 37 38 print F "0\n"; … … 50 51 51 52 $this->{twiki}->finish(); 52 $this->{twiki} = new TWiki();53 $this->{twiki} = new Foswiki(); 53 54 $this->{twiki}->net->setMailHandler(\&sentMail); 54 55 55 56 $box = {}; 56 57 57 # Make a maildir 58 58 my $tmp = "/tmp/mail$$"; … … 62 62 $box->{folder} = "$tmp/"; 63 63 64 $ TWiki::cfg{MailInContrib} = [ $box ];64 $Foswiki::cfg{MailInContrib} = [ $box ]; 65 65 @mails = (); 66 66 } … … 94 94 sub cron { 95 95 my $this = shift; 96 my $min = new TWiki::Contrib::MailInContrib( $this->{twiki}, 0 );96 my $min = new Foswiki::Contrib::MailInContrib( $this->{twiki}, 0 ); 97 97 $min->processInbox( $box ); 98 98 $min->wrapUp(); … … 119 119 and there is no valid default username', $c->{error}); 120 120 121 my( $m, $t ) = TWiki::Func::readTopic($this->{test_web},$this->{test_topic});121 my( $m, $t ) = Foswiki::Func::readTopic($this->{test_web},$this->{test_topic}); 122 122 123 123 $this->assert($t !~ /\S/, $t); … … 154 154 $this->assert_null($c->{error}); 155 155 156 my( $m, $t ) = TWiki::Func::readTopic($this->{test_web},$this->{test_topic});156 my( $m, $t ) = Foswiki::Func::readTopic($this->{test_web},$this->{test_topic}); 157 157 158 158 $this->assert($t =~ s/^ *\* \*$this->{test_web}\.NotHere\*: Message 1 text here\s*-- $this->{users_web}\.MoleInnaHole -\s+\d+\s+\w+\s+\d+\s+-\s+\d+:\d+\n//m, $t); … … 190 190 $this->assert_null($c->{error}); 191 191 192 my( $m, $t ) = TWiki::Func::readTopic($this->{test_web},$this->{test_topic});192 my( $m, $t ) = Foswiki::Func::readTopic($this->{test_web},$this->{test_topic}); 193 193 194 194 $this->assert($t =~ s/^\s*\* \*\*: Message 1 text here\s* -- $this->{users_web}\.MoleInnaHole -\s+\d+\s+\w+\s+\d+\s+-\s+\d+:\d+$//m, $t); … … 223 223 $this->assert_null($c->{error}); 224 224 225 my( $m, $t ) = TWiki::Func::readTopic($this->{test_web},'DangleBerries');225 my( $m, $t ) = Foswiki::Func::readTopic($this->{test_web},'DangleBerries'); 226 226 227 227 $t =~ s/\* \*no valid topic\*: Message 1 text here\s*-- $this->{users_web}.AllyGator -\s+\d+\s+\w+\s+\d+\s+-\s+\d+:\d+//s; … … 367 367 my $c = $this->cron(); 368 368 369 print STDERR "VBLO\n"; 369 370 $this->assert_equals(1, scalar(@mails)); 370 371 $this->assert_matches(qr/Thank you for your successful/, $mails[0]); 371 372 372 my( $m, $t ) = TWiki::Func::readTopic($this->{test_web},'AnotherTopic');373 my( $m, $t ) = Foswiki::Func::readTopic($this->{test_web},'AnotherTopic'); 373 374 my @a = $m->get('FILEATTACHMENT'); 374 375 $this->assert_equals(1, scalar(@a)); 375 376 $this->assert_str_equals("data.asc", $a[0]->{attachment}); 376 377 377 $this->assert(-e "$ TWiki::cfg{PubDir}/$this->{test_web}/AnotherTopic/data.asc");378 $this->assert(-e "$Foswiki::cfg{PubDir}/$this->{test_web}/AnotherTopic/data.asc"); 378 379 } 379 380 … … 395 396 $box->{onSuccess} = 'reply delete'; 396 397 $this->{twiki}->{store}->saveTopic( 397 $this->{twiki}->{user}, $ TWiki::cfg{SystemWebName},398 $this->{twiki}->{user}, $Foswiki::cfg{SystemWebName}, 398 399 'MailInContribUserTemplate', <<'HERE'); 399 400 %TMPL:DEF{MAILIN:wierd}% … … 414 415 $this->assert_matches(qr/Thank you for your successful/, $mails[0]); 415 416 416 my( $m, $t ) = TWiki::Func::readTopic($this->{test_web},'TargetTopic');417 my( $m, $t ) = Foswiki::Func::readTopic($this->{test_web},'TargetTopic'); 417 418 418 419 $this->assert_matches(qr/BEGIN\s*Subject: Object\s*Body: Message 1 text here\s*<!--MAIL{/s, $t);
Note: See TracChangeset
for help on using the changeset viewer.
