- Timestamp:
- 01/29/09 13:35:57 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ActionTrackerPlugin/test/unit/ActionTrackerPlugin/ActionNotifyTests.pm
r1340 r2226 4 4 use strict; 5 5 6 use TWiki::Plugins::ActionTrackerPlugin::Action;7 use TWiki::Plugins::ActionTrackerPlugin::ActionSet;8 use TWiki::Plugins::ActionTrackerPlugin::ActionNotify;9 use TWiki::Plugins::ActionTrackerPlugin::Format;10 use TWiki::Plugins::ActionTrackerPlugin::Options;6 use Foswiki::Plugins::ActionTrackerPlugin::Action; 7 use Foswiki::Plugins::ActionTrackerPlugin::ActionSet; 8 use Foswiki::Plugins::ActionTrackerPlugin::ActionNotify; 9 use Foswiki::Plugins::ActionTrackerPlugin::Format; 10 use Foswiki::Plugins::ActionTrackerPlugin::Options; 11 11 use Time::ParseDate; 12 use TWiki::Attrs;13 use TWiki::Store::RcsLite;12 use Foswiki::Attrs; 13 use Foswiki::Store::RcsLite; 14 14 15 15 sub new { … … 22 22 23 23 $this->SUPER::set_up(); 24 $ TWiki::cfg{Plugins}{ActionTrackerPlugin}{Enabled} = 1;24 $Foswiki::cfg{Plugins}{ActionTrackerPlugin}{Enabled} = 1; 25 25 26 26 # Use RcsLite so we can manually gen topic revs 27 $ TWiki::cfg{StoreImpl} = 'RcsLite';27 $Foswiki::cfg{StoreImpl} = 'RcsLite'; 28 28 29 29 # Need this to get the actionnotify template … … 31 31 my $d = "$lib/../templates"; 32 32 if (-e "$d/actionnotify.tmpl") { 33 $ TWiki::cfg{TemplateDir} = $d;33 $Foswiki::cfg{TemplateDir} = $d; 34 34 last; 35 35 } 36 36 } 37 37 38 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("3 Jun 2002");38 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("3 Jun 2002"); 39 39 40 40 # Actor 1 - wikiname in main, not a member of any groups … … 84 84 'actor6@correct-address'); 85 85 86 TWiki::Func::saveTopic($this->{users_web}, "TWikiFormGroup", undef, <<'HERE');86 Foswiki::Func::saveTopic($this->{users_web}, "TWikiFormGroup", undef, <<'HERE'); 87 87 Garbage 88 88 * Set GROUP = ActorThree, ActorFour 89 89 More garbage 90 90 HERE 91 TWiki::Func::saveTopic($this->{users_web}, "WebNotify", undef, <<HERE);91 Foswiki::Func::saveTopic($this->{users_web}, "WebNotify", undef, <<HERE); 92 92 Garbage 93 93 * $this->{users_web}.ActorFive - actor5\@correct.address … … 95 95 * $this->{users_web}.ActorSix 96 96 HERE 97 TWiki::Func::saveTopic($this->{test_web}, "WebNotify", undef, <<HERE97 Foswiki::Func::saveTopic($this->{test_web}, "WebNotify", undef, <<HERE 98 98 * $this->{users_web}.ActorEight - actor-8\@correct.address 99 99 HERE 100 100 ); 101 TWiki::Func::saveTopic($this->{users_web}, "EMailGroup", undef, <<'HERE');102 * Set GROUP = actorTwo@another-address.net,ActorFour103 HERE 104 105 TWiki::Func::saveTopic($this->{test_web}, "Topic1", undef, <<'HERE');101 Foswiki::Func::saveTopic($this->{users_web}, "EMailGroup", undef, <<'HERE'); 102 * Set GROUP = ActorTwo,ActorFour 103 HERE 104 105 Foswiki::Func::saveTopic($this->{test_web}, "Topic1", undef, <<'HERE'); 106 106 %ACTION{who="ActorOne,ActorTwo,ActorThree,ActorFour,ActorFive,ActorSix,ActorSeven,ActorEight" due="3 Jan 02" state=open}% A1: ontime 107 107 HERE 108 TWiki::Func::saveTopic($this->{test_web}, "Topic2", undef, <<'HERE');108 Foswiki::Func::saveTopic($this->{test_web}, "Topic2", undef, <<'HERE'); 109 109 %ACTION{who="ActorOne,ActorTwo,ActorThree,ActorFour,ActorFive,ActorSix,actor.7@seven.net,ActorEight" due="2 Jan 02" state=closed}% A2: closed 110 110 HERE 111 TWiki::Func::saveTopic($this->{users_web}, "Topic1", undef, <<'HERE');111 Foswiki::Func::saveTopic($this->{users_web}, "Topic1", undef, <<'HERE'); 112 112 %ACTION{who="ActorOne,ActorTwo,ActorThree,ActorFour,ActorFive,ActorSix,actor.7@seven.net,ActorEight,NonEntity",due="3 Jan 01",state=open}% A3: late 113 113 %ACTION{who=TWikiFormGroup,due="4 Jan 01",state=open}% A4: late 114 114 HERE 115 TWiki::Func::saveTopic($this->{users_web}, "Topic2", undef, <<'HERE');115 Foswiki::Func::saveTopic($this->{users_web}, "Topic2", undef, <<'HERE'); 116 116 %ACTION{who=EMailGroup,due="2001-01-05",state=open}% A5: late 117 117 %ACTION{who="ActorOne,ActorTwo,ActorThree,ActorFour,TWikiFormGroup,ActorFive,ActorSix,actor.7@seven.net,ActorEight,EMailGroup",due="6 Jan 99",open}% A6: late 118 118 HERE 119 119 120 my $rcs = new TWiki::Store::RcsLite($this->{twiki}, $this->{test_web}, "ActionChanged" );120 my $rcs = new Foswiki::Store::RcsLite($this->{twiki}, $this->{test_web}, "ActionChanged" ); 121 121 my $t1 = Time::ParseDate::parsedate("21 Jun 2001"); 122 122 $rcs->addRevisionFromText(<<HERE, 'Initial revision', 'crawford', $t1); … … 153 153 ); 154 154 my $who = 155 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress('a@b.c',\%ma);155 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress('a@b.c',\%ma); 156 156 $this->assert_str_equals( 'a@b.c', $who); 157 157 158 158 $who = 159 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("$this->{users_web}.BimboChimp",\%ma);159 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("$this->{users_web}.BimboChimp",\%ma); 160 160 $this->assert_str_equals( 'bimbo@zoo.org', $who); 161 161 162 162 $who = 163 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("BimboChimp",\%ma);163 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("BimboChimp",\%ma); 164 164 $this->assert_str_equals( 'bimbo@zoo.org', $who); 165 165 166 166 $who = 167 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("PaxoHen,BimboChimp , BonzoClown",\%ma);167 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("PaxoHen,BimboChimp , BonzoClown",\%ma); 168 168 $this->assert_str_equals( 'chicken@farm.net,bimbo@zoo.org,bonzo@circus.com', $who); 169 169 170 $who = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorOne",\%ma);170 $who = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorOne",\%ma); 171 171 $this->assert_str_equals( 'actor-1@an-address.net', $who); 172 173 $who = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("EMailGroup",\%ma); 174 $this->assert_str_equals( "actorTwo\@another-address.net,actorfour\@yet-another-address.net", $who); 175 $who = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("TWikiFormGroup",\%ma); 176 $this->assert_str_equals( "actor3\@yet-another-address.net,actorfour\@yet-another-address.net", $who); 177 178 $who = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorFive",\%ma); 172 $who = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("EMailGroup",\%ma); 173 $this->assert_str_equals( "actorTwo\@another-address.net,actorfour\@yet-another-address.net", join(',',sort split(/[, ]+/, $who))); 174 $who = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("TWikiFormGroup",\%ma); 175 $this->assert_str_equals( "actor3\@yet-another-address.net,actorfour\@yet-another-address.net", join(',',sort split(/[, ]+/, $who))); 176 177 $who = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorFive",\%ma); 179 178 $this->assert_str_equals('actor5@example.com', $who); 180 $who = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorEight",\%ma);179 $who = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorEight",\%ma); 181 180 $this->assert_null($who); 182 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_loadWebNotify($this->{users_web},\%ma);183 $who = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorFive",\%ma);181 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_loadWebNotify($this->{users_web},\%ma); 182 $who = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorFive",\%ma); 184 183 $this->assert_str_equals( "actor5\@example.com", $who); 185 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_loadWebNotify($this->{test_web},\%ma);186 $who = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorEight",\%ma);184 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_loadWebNotify($this->{test_web},\%ma); 185 $who = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorEight",\%ma); 187 186 $this->assert_str_equals( "actor-8\@correct.address", $who); 188 187 } … … 192 191 my $html; 193 192 194 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("2 Jan 2002");195 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::doNotifications($this->{twiki}->{webName}, "web='($this->{test_web}|$this->{users_web})' late" );193 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("2 Jan 2002"); 194 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::doNotifications($this->{twiki}->{webName}, "web='($this->{test_web}|$this->{users_web})' late" ); 196 195 if(scalar(@FoswikiFnTestCase::mails!= 8)) { 197 196 my $mess = scalar(@FoswikiFnTestCase::mails)." mails received"; … … 287 286 sub test_C_ChangedSince { 288 287 my $this = shift; 289 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("2 Jan 2002");290 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::doNotifications(288 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("2 Jan 2002"); 289 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::doNotifications( 291 290 $this->{twiki}->{webName}, 'changedsince="1 dec 2001" web="'.$this->{test_web}.'"' ); 292 291 my $saw = "";
Note: See TracChangeset
for help on using the changeset viewer.
