Changeset 12558
- Timestamp:
- 09/18/11 12:43:08 (20 months ago)
- Location:
- branches/scratch/UnitTestContrib/test/unit
- Files:
-
- 4 edited
-
FoswikiFnTestCase.pm (modified) (1 diff)
-
FoswikiTestCase.pm (modified) (1 diff)
-
FuncUsersTests.pm (modified) (1 diff)
-
PrefsTests.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/scratch/UnitTestContrib/test/unit/FoswikiFnTestCase.pm
r12483 r12558 109 109 $this->{test_user_cuid} = 110 110 $this->{session}->{users}->getCanonicalUserID( $this->{test_user_login} ); 111 $this->{test_topicObject} = Foswiki::Meta->new( 112 $this->{session}, $this->{test_web}, 113 $this->{test_topic}, "BLEEGLE\n" 114 ); 111 112 $this->{test_topicObject} = Foswiki::Store::create(address=>{web=>$this->{test_web}, topic=>$this->{test_topic}}); 113 $this->{test_topicObject}->text("BLEEGLE\n"); 115 114 $this->{test_topicObject}->save(forcedate=>(time()+60)); 116 115 } -
branches/scratch/UnitTestContrib/test/unit/FoswikiTestCase.pm
r12489 r12558 266 266 267 267 try { 268 my $webObject = Foswiki:: Meta->new( $session, $web);268 my $webObject = Foswiki::Store->load( address=>{web=>$web} ); 269 269 $webObject->removeFromStore(); 270 270 } -
branches/scratch/UnitTestContrib/test/unit/FuncUsersTests.pm
r12435 r12558 1762 1762 } 1763 1763 1764 sub verify_denyNonAdminReadOfAdminGroupTopic { 1765 my $this = shift; 1766 1767 return if ( $this->noUsersRegistered() ); 1768 1769 # Force a re-read 1770 $this->{session}->finish(); 1771 $this->{session} = new Foswiki( $Foswiki::cfg{AdminUserLogin} ); 1772 $Foswiki::Plugins::SESSION = $this->{session}; 1773 1774 $this->assert( Foswiki::Func::addUserToGroup( 'UserB', 'AdminGroup', 1 ) ); 1775 1776 my $topicObject = 1777 Foswiki::Meta->new( $this->{session}, $this->{users_web}, 1778 'AdminGroup' ); 1779 $topicObject->load(); 1780 $topicObject->text($topicObject."\n\n * Set ALLOWTOPICVIEW = AdminGroup\n\n"); 1781 $topicObject->save(); 1782 1783 1784 { 1785 $this->{session}->finish(); 1786 $this->{session} = new Foswiki( $Foswiki::cfg{AdminUserLogin} ); 1787 $Foswiki::Plugins::SESSION = $this->{session}; 1788 1789 my $it = Foswiki::Func::eachGroupMember('AdminGroup'); 1790 my @list; 1791 while ( $it->hasNext() ) { 1792 my $g = $it->next(); 1793 push( @list, $g ); 1794 } 1795 #as the baseusermapper is always admin, they should always see the full list 1796 $this->assert_str_equals( "AdminUser,UserA,UserB", 1797 sort join( ',', @list ) ); 1798 $this->assert($this->{session}->isAdmin()); 1799 } 1800 1801 { 1802 # Force a re-read 1803 $this->{session}->finish(); 1804 $this->{session} = new Foswiki( 'UserB' ); 1805 $Foswiki::Plugins::SESSION = $this->{session}; 1806 1807 my $it = Foswiki::Func::eachGroupMember('AdminGroup'); 1808 my @list; 1809 while ( $it->hasNext() ) { 1810 my $g = $it->next(); 1811 push( @list, $g ); 1812 } 1813 $this->assert_str_equals( "AdminUser,UserA,UserB", 1814 sort join( ',', @list ) ); 1815 $this->assert($this->{session}->isAdmin()) 1816 } 1817 1818 { 1819 # Force a re-read 1820 $this->{session}->finish(); 1821 $this->{session} = new Foswiki( 'UserZ' ); 1822 $Foswiki::Plugins::SESSION = $this->{session}; 1823 1824 my $it = Foswiki::Func::eachGroupMember('AdminGroup'); 1825 my @list; 1826 while ( $it->hasNext() ) { 1827 my $g = $it->next(); 1828 push( @list, $g ); 1829 } 1830 $this->assert_str_equals( "AdminUser,UserA,UserB", 1831 sort join( ',', @list ) ); 1832 $this->assert(not $this->{session}->isAdmin()) 1833 } 1834 } 1835 1836 1764 1837 1; -
branches/scratch/UnitTestContrib/test/unit/PrefsTests.pm
r8245 r12558 44 44 my $webObject = Foswiki::Meta->new( $this->{session}, $TWiki::cfg{SystemWebName} ); 45 45 $webObject->populateNewWeb($original); 46 my $m = 47 Foswiki::Meta->load( $this->{session}, $original, 48 $TWiki::cfg{SitePrefsTopicName} ); 49 $m->saveAs( $TWiki::cfg{SystemWebName}, 50 $TWiki::cfg{SitePrefsTopicName} ); 46 47 my $orig_sitepref = Foswiki::Store::load(address=>{web=>$original, topic=>$Foswiki::cfg{SitePrefsTopicName}}); 48 my $m = Foswiki::Store::create(address=>{web=>$TWiki::cfg{SystemWebName}, topic=>$Foswiki::cfg{SitePrefsTopicName}}, data=>{_text=>$orig_sitepref->text()}); 49 $m->save(); 51 50 } 52 51 catch Foswiki::AccessControlException with { … … 80 79 my $user = $fatwilly->{user}; 81 80 $this->assert_not_null($user); 82 my $topicObject = Foswiki::Meta->load( $fatwilly, $web, $topic ); 81 my $topicObject = Foswiki::Store::load(address=>{web=>$web, topic=>$topic}); 82 83 83 my $text = $topicObject->text() || ''; 84 84 $text =~ s/^\s*\* $type $pref =.*$//gm;
Note: See TracChangeset
for help on using the changeset viewer.
