Changeset 816 for trunk/UnitTestContrib/test/unit/ClientTests.pm
- Timestamp:
- 11/19/08 19:11:33 (4 years ago)
- File:
-
- 1 edited
-
trunk/UnitTestContrib/test/unit/ClientTests.pm (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/UnitTestContrib/test/unit/ClientTests.pm
r672 r816 6 6 # LoginManager.pm compiles okay. 7 7 8 use base qw( TWikiFnTestCase);8 use base qw(FoswikiFnTestCase); 9 9 10 10 use Unit::Request; 11 11 use Error qw( :try ); 12 12 13 use TWiki;14 use TWiki::LoginManager;15 use TWiki::UI::View;16 use TWiki::UI::Edit;13 use Foswiki; 14 use Foswiki::LoginManager; 15 use Foswiki::UI::View; 16 use Foswiki::UI::Edit; 17 17 18 my $agent = $ TWiki::cfg{Register}{RegistrationAgentWikiName};18 my $agent = $Foswiki::cfg{Register}{RegistrationAgentWikiName}; 19 19 my $userLogin; 20 20 my $userWikiName; … … 32 32 33 33 sub TemplateLoginManager { 34 $ TWiki::cfg{LoginManager} = 'TWiki::LoginManager::TemplateLogin';34 $Foswiki::cfg{LoginManager} = 'Foswiki::LoginManager::TemplateLogin'; 35 35 } 36 36 37 37 sub ApacheLoginManager { 38 $ TWiki::cfg{LoginManager} = 'TWiki::LoginManager::ApacheLogin';38 $Foswiki::cfg{LoginManager} = 'Foswiki::LoginManager::ApacheLogin'; 39 39 } 40 40 41 41 sub NoLoginManager { 42 $ TWiki::cfg{LoginManager} = 'none';42 $Foswiki::cfg{LoginManager} = 'none'; 43 43 } 44 44 45 45 sub BaseUserMapping { 46 46 my $this = shift; 47 $ TWiki::cfg{UserMappingManager} = 'TWiki::Users::BaseUserMapping';47 $Foswiki::cfg{UserMappingManager} = 'Foswiki::Users::BaseUserMapping'; 48 48 $this->set_up_for_verify(); 49 49 } … … 51 51 sub TopicUserMapping { 52 52 my $this = shift; 53 $ TWiki::cfg{UserMappingManager} = 'TWiki::Users::TopicUserMapping';53 $Foswiki::cfg{UserMappingManager} = 'Foswiki::Users::TopicUserMapping'; 54 54 $this->set_up_for_verify(); 55 55 } … … 67 67 68 68 $this->{twiki}->finish() if $this->{twiki}; 69 $this->{twiki} = new TWiki(undef, new Unit::Request());70 $this->assert($ TWiki::cfg{TempfileDir} && -d $TWiki::cfg{TempfileDir});71 $ TWiki::cfg{UseClientSessions} = 1;72 $ TWiki::cfg{PasswordManager} = "TWiki::Users::HtPasswdUser";73 $ TWiki::cfg{Htpasswd}{FileName} = "$TWiki::cfg{TempfileDir}/htpasswd";74 $ TWiki::cfg{AuthScripts} = "edit";75 $ TWiki::cfg{Register}{EnableNewUserRegistration} = 1;76 $ TWiki::cfg{UsersWebName} = $this->{users_web};69 $this->{twiki} = new Foswiki(undef, new Unit::Request()); 70 $this->assert($Foswiki::cfg{TempfileDir} && -d $Foswiki::cfg{TempfileDir}); 71 $Foswiki::cfg{UseClientSessions} = 1; 72 $Foswiki::cfg{PasswordManager} = "Foswiki::Users::HtPasswdUser"; 73 $Foswiki::cfg{Htpasswd}{FileName} = "$Foswiki::cfg{TempfileDir}/htpasswd"; 74 $Foswiki::cfg{AuthScripts} = "edit"; 75 $Foswiki::cfg{Register}{EnableNewUserRegistration} = 1; 76 $Foswiki::cfg{UsersWebName} = $this->{users_web}; 77 77 } 78 78 … … 85 85 $this->annotate("create $userLogin user - cUID = $user_id\n"); 86 86 } else { 87 $userLogin = $ TWiki::cfg{AdminUserLogin};87 $userLogin = $Foswiki::cfg{AdminUserLogin}; 88 88 $user_id = $this->{twiki}->{users}->getCanonicalUserID($userLogin); 89 89 $userWikiName = $this->{twiki}->{users}->getWikiName($user_id); … … 106 106 my ( $query, $text ); 107 107 108 #close this TWiki session - its using the wrong mapper and login108 #close this Foswiki session - its using the wrong mapper and login 109 109 $this->{twiki}->finish(); 110 110 111 111 $query = new Unit::Request(); 112 112 $query->path_info( "/$this->{test_web}/$this->{test_topic}" ); 113 $this->{twiki} = new TWiki( undef, $query );113 $this->{twiki} = new Foswiki( undef, $query ); 114 114 115 115 $this->set_up_user(); 116 116 try { 117 $text = $this->capture( \& TWiki::UI::View::view, $this->{twiki} );118 } catch TWiki::OopsException with {117 $text = $this->capture( \&Foswiki::UI::View::view, $this->{twiki} ); 118 } catch Foswiki::OopsException with { 119 119 $this->assert(0,shift->stringify()); 120 120 } catch Error::Simple with { … … 126 126 $this->{twiki}->finish(); 127 127 128 $this->{twiki} = new TWiki( undef, $query );128 $this->{twiki} = new Foswiki( undef, $query ); 129 129 130 130 try { 131 $text = $this->capture( \& TWiki::UI::Edit::edit, $this->{twiki} );132 } catch TWiki::AccessControlException with {131 $text = $this->capture( \&Foswiki::UI::Edit::edit, $this->{twiki} ); 132 } catch Foswiki::AccessControlException with { 133 133 } catch Error::Simple with { 134 134 $this->assert(0,shift->stringify()); 135 135 } otherwise { 136 unless( $ TWiki::cfg{LoginManager} eq 'none' ) {136 unless( $Foswiki::cfg{LoginManager} eq 'none' ) { 137 137 $this->assert(0, "expected an access control exception: ". 138 $ TWiki::cfg{LoginManager}."\n$text");138 $Foswiki::cfg{LoginManager}."\n$text"); 139 139 } 140 140 }; … … 146 146 $this->annotate("new session using $userLogin\n"); 147 147 148 $this->{twiki} = new TWiki( $userLogin, $query );148 $this->{twiki} = new Foswiki( $userLogin, $query ); 149 149 150 150 #clear the lease - one of the previous tests may have different usermapper & thus different user 151 TWiki::Func::setTopicEditLock($this->{test_web}, $this->{test_topic}, 0);151 Foswiki::Func::setTopicEditLock($this->{test_web}, $this->{test_topic}, 0); 152 152 } 153 153 … … 161 161 my $secret = "a big mole on my left buttock"; 162 162 my $crypted = crypt($secret, "12"); 163 $ TWiki::cfg{Password} = $crypted;163 $Foswiki::cfg{Password} = $crypted; 164 164 165 165 my $query = new Unit::Request({ 166 username => [ $ TWiki::cfg{AdminUserLogin} ],166 username => [ $Foswiki::cfg{AdminUserLogin} ], 167 167 password => [ $secret ], 168 168 Logon => [ 1 ], … … 171 171 $query->path_info( "/$this->{test_web}/$this->{test_topic}" ); 172 172 173 $this->{twiki} = new TWiki(undef, $query);173 $this->{twiki} = new Foswiki(undef, $query); 174 174 my ($text, $result) = $this->capture( 175 175 sub {
Note: See TracChangeset
for help on using the changeset viewer.
