- Timestamp:
- 01/23/12 07:00:46 (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Release01x01/UnitTestContrib/test/unit/Fn_GROUPINFO.pm
r13729 r13794 1 # tests for the correct expansion of GROUPINFO 2 3 package Fn_GROUPINFO; 1 4 use strict; 2 3 # tests for the correct expansion of GROUPINFO 4 5 package Fn_GROUPINFO; 6 7 use FoswikiFnTestCase; 5 use warnings; 6 7 use FoswikiFnTestCase(); 8 8 our @ISA = qw( FoswikiFnTestCase ); 9 9 10 use Foswiki; 10 use Foswiki(); 11 use Foswiki::Func(); 11 12 use Error qw( :try ); 12 13 13 14 sub new { 15 my ( $class, @args ) = @_; 16 14 17 $Foswiki::cfg{Register}{AllowLoginName} = 1; 15 my $self = shift()->SUPER::new( 'GROUPINFO', @_ ); 16 return $ self;18 19 return $class->SUPER::new( 'GROUPINFO', @args ); 17 20 } 18 21 … … 20 23 my $this = shift; 21 24 $this->SUPER::set_up(@_); 22 my $topicObject = 23 Foswiki::Meta->new( $this->{session}, $this->{users_web}, "GropeGroup", 24 " * Set GROUP = ScumBag,WikiGuest\n" ); 25 $topicObject->save(); 26 $topicObject = 27 Foswiki::Meta->new( $this->{session}, $this->{users_web}, "PopGroup", 28 " * Set GROUP = WikiGuest\n" ); 29 $topicObject->save(); 30 $topicObject = Foswiki::Meta->new( 31 $this->{session}, $this->{users_web}, 32 "NestingGroup", " * Set GROUP = GropeGroup\n" 33 ); 34 $topicObject->save(); 35 $topicObject = 36 Foswiki::Meta->new( $this->{session}, $this->{users_web}, 37 "OnlyAdminCanChangeGroup", 38 " * Set GROUP = WikiGuest\n * Set TOPICCHANGE = AdminGroup\n" ); 39 $topicObject->save(); 40 $topicObject = 41 Foswiki::Meta->new( $this->{session}, $this->{users_web}, 42 "GroupWithHiddenGroup", " * Set GROUP = HiddenGroup,WikiGuest\n" ); 43 $topicObject->save(); 44 $topicObject = 45 Foswiki::Meta->new( $this->{session}, $this->{users_web}, "HiddenGroup", 46 " * Set GROUP = ScumBag\n * Set ALLOWTOPICVIEW = AdminUser\n" ); 47 $topicObject->save(); 48 49 $topicObject = 50 Foswiki::Meta->new( $this->{session}, $this->{users_web}, 51 "HiddenUserGroup", " * Set GROUP = ScumBag,HidemeGood\n" ); 52 $topicObject->save(); 53 54 $topicObject = 55 Foswiki::Meta->load( $this->{session}, $this->{users_web}, "HidemeGood" ); 25 my ($topicObject) = 26 Foswiki::Func::readTopic( $this->{users_web}, "GropeGroup" ); 27 $topicObject->text(" * Set GROUP = ScumBag,WikiGuest\n"); 28 $topicObject->save(); 29 $topicObject->finish(); 30 ($topicObject) = Foswiki::Func::readTopic( $this->{users_web}, "PopGroup" ); 31 $topicObject->text(" * Set GROUP = WikiGuest\n"); 32 $topicObject->save(); 33 $topicObject->finish(); 34 ($topicObject) = 35 Foswiki::Func::readTopic( $this->{users_web}, "NestingGroup" ); 36 $topicObject->text(" * Set GROUP = GropeGroup\n"); 37 $topicObject->save(); 38 $topicObject->finish(); 39 ($topicObject) = 40 Foswiki::Func::readTopic( $this->{users_web}, "OnlyAdminCanChangeGroup" ); 41 $topicObject->text( 42 " * Set GROUP = WikiGuest\n * Set TOPICCHANGE = AdminGroup\n"); 43 $topicObject->save(); 44 $topicObject->finish(); 45 ($topicObject) = 46 Foswiki::Func::readTopic( $this->{users_web}, "GroupWithHiddenGroup" ); 47 $topicObject->text(" * Set GROUP = HiddenGroup,WikiGuest\n"); 48 $topicObject->save(); 49 $topicObject->finish(); 50 ($topicObject) = 51 Foswiki::Func::readTopic( $this->{users_web}, "HiddenGroup" ); 52 $topicObject->text( 53 " * Set GROUP = ScumBag\n * Set ALLOWTOPICVIEW = AdminUser\n"); 54 $topicObject->save(); 55 $topicObject->finish(); 56 ($topicObject) = 57 Foswiki::Func::readTopic( $this->{users_web}, "HiddenUserGroup" ); 58 $topicObject->text(" * Set GROUP = ScumBag,HidemeGood\n"); 59 $topicObject->save(); 60 $topicObject->finish(); 61 ($topicObject) = 62 Foswiki::Func::readTopic( $this->{users_web}, "HidemeGood" ); 56 63 my $topText = $topicObject->text(); 57 64 $topText .= " * Set ALLOWTOPICVIEW = AdminUser\n"; 58 65 $topText = $topicObject->text($topText); 59 66 $topicObject->save(); 60 67 $topicObject->finish(); 68 69 return; 61 70 } 62 71 … … 70 79 $this->assert_matches( qr/\bGroupWithHiddenGroup\b/, $ui ); 71 80 $this->assert_does_not_match( qr/\bHiddenGroup\b/, $ui ); 81 82 return; 72 83 } 73 84 … … 79 90 $this->assert_matches( qr/\b$this->{users_web}.ScumBag\b/, $ui ); 80 91 $this->assert_matches( qr/\b$this->{users_web}.WikiGuest\b/, $ui ); 81 my @u = split( ',', $ui );92 my @u = split( /,/, $ui ); 82 93 $this->assert( 2, scalar(@u) ); 94 95 return; 83 96 } 84 97 … … 95 108 $this->assert_matches( qr/\b$this->{users_web}.ScumBag\b/, $ui ); 96 109 $this->assert_matches( qr/\b$this->{users_web}.WikiGuest\b/, $ui ); 97 my @u = split( ',', $ui );110 my @u = split( /,/, $ui ); 98 111 $this->assert( 2, scalar(@u) ); 112 113 return; 99 114 } 100 115 … … 107 122 $this->assert_matches( qr/\b$this->{users_web}.WikiGuest\b/, $ui ); 108 123 $this->assert_does_not_match( qr/\b$this->{users_web}.HiddenGroup\b/, $ui ); 109 my @u = split( ',', $ui );124 my @u = split( /,/, $ui ); 110 125 $this->assert( 1, scalar(@u) ); 126 127 return; 111 128 } 112 129 … … 127 144 $ui, 'ScumBag revealed' ); 128 145 129 my @u = split( ',', $ui );146 my @u = split( /,/, $ui ); 130 147 $this->assert( 1, scalar(@u) ); 148 149 return; 131 150 } 132 151 … … 141 160 $this->assert_does_not_match( qr/\b$this->{users_web}.HidemeGood\b/, 142 161 $ui, 'HidemeGood revealed' ); 143 my @u = split( ',', $ui );162 my @u = split( /,/, $ui ); 144 163 $this->assert( 1, scalar(@u) ); 164 165 return; 145 166 } 146 167 … … 148 169 my $this = shift; 149 170 150 $this->{session}->finish(); 151 $this->{session} = new Foswiki( $Foswiki::cfg{AdminUserLogin} ); 152 $this->{test_topicObject} = Foswiki::Meta->new( 153 $this->{session}, $this->{test_web}, 154 $this->{test_topic}, "BLEEGLE\n" 155 ); 171 $this->createNewFoswikiSession( $Foswiki::cfg{AdminUserLogin} ); 172 $this->{test_topicObject}->finish if $this->{test_topicObject}; 173 ( $this->{test_topicObject} ) = 174 Foswiki::Func::readTopic( $this->{test_web}, $this->{test_topic} ); 175 $this->{test_topicObject}->text("BLEEGLE\n"); 156 176 $this->{test_topicObject}->save(); 157 177 … … 161 181 $this->assert_matches( qr/$this->{users_web}.ScumBag/, $ui ); 162 182 $this->assert_matches( qr/$this->{users_web}.HidemeGood/, $ui ); 163 my @u = split( ',', $ui );183 my @u = split( /,/, $ui ); 164 184 $this->assert( 2, scalar(@u) ); 185 $this->{test_topicObject}->finish(); 186 187 return; 165 188 } 166 189 … … 201 224 ); 202 225 $this->assert_matches( qr/^<\w+>LF$/, $ui ); 226 227 return; 203 228 } 204 229
Note: See TracChangeset
for help on using the changeset viewer.
