[Rt-commit] r2932 - in rt/branches/3.4-RELEASE/lib: RT/URI t/regression

glasser at bestpractical.com glasser at bestpractical.com
Mon May 23 13:04:38 EDT 2005


Author: glasser
Date: Mon May 23 13:04:38 2005
New Revision: 2932

Modified:
   rt/branches/3.4-RELEASE/lib/RT/URI/fsck_com_rt.pm
   rt/branches/3.4-RELEASE/lib/RT/URI/t.pm
   rt/branches/3.4-RELEASE/lib/t/regression/02basic_web.t
   rt/branches/3.4-RELEASE/lib/t/regression/03web_compiliation_errors.t
   rt/branches/3.4-RELEASE/lib/t/regression/06mailgateway.t
   rt/branches/3.4-RELEASE/lib/t/regression/07acl.t
   rt/branches/3.4-RELEASE/lib/t/regression/08web_cf_access.t
Log:
Allow for base URL to be changed when doing regressions.
(And kind of allow for Organization to be changed, except the mailgate
test will still bite it if you do.)

Modified: rt/branches/3.4-RELEASE/lib/RT/URI/fsck_com_rt.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/URI/fsck_com_rt.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/URI/fsck_com_rt.pm	Mon May 23 13:04:38 2005
@@ -75,7 +75,7 @@
 ok ($uri->isa('RT::URI::base'), "It's an RT::URI::base");
 ok ($uri->isa('RT::Base'), "It's an RT::Base");
 
-is ($uri->LocalURIPrefix , 'fsck.com-rt://example.com');
+is ($uri->LocalURIPrefix , 'fsck.com-rt://'.$RT::Organization);
 
 =end testing
 

Modified: rt/branches/3.4-RELEASE/lib/RT/URI/t.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/URI/t.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/URI/t.pm	Mon May 23 13:04:38 2005
@@ -47,7 +47,7 @@
 $uri->ParseURI($uristr);
 is(ref($uri->Object), "RT::Ticket", "Object loaded is a ticket");
 is($uri->Object->Id, 1, "Object loaded has correct ID");
-is($uri->URI, 'fsck.com-rt://example.com/ticket/1',
+is($uri->URI, 'fsck.com-rt://'.$RT::Organization.'/ticket/1',
    "URI object has correct URI string");
 
 =end testing

Modified: rt/branches/3.4-RELEASE/lib/t/regression/02basic_web.t
==============================================================================
--- rt/branches/3.4-RELEASE/lib/t/regression/02basic_web.t	(original)
+++ rt/branches/3.4-RELEASE/lib/t/regression/02basic_web.t	Mon May 23 13:04:38 2005
@@ -15,9 +15,11 @@
 
 $agent->cookie_jar($cookie_jar);
 
+use RT;
+RT::LoadConfig;
 
 # get the top page
-my $url = "http://localhost".$RT::WebPath."/";
+my $url = $RT::WebURL;
 $agent->get($url);
 
 is ($agent->{'status'}, 200, "Loaded a page");

Modified: rt/branches/3.4-RELEASE/lib/t/regression/03web_compiliation_errors.t
==============================================================================
--- rt/branches/3.4-RELEASE/lib/t/regression/03web_compiliation_errors.t	(original)
+++ rt/branches/3.4-RELEASE/lib/t/regression/03web_compiliation_errors.t	Mon May 23 13:04:38 2005
@@ -15,9 +15,11 @@
 
 $agent->cookie_jar($cookie_jar);
 
+use RT;
+RT::LoadConfig;
 
 # get the top page
-my $url = "http://localhost".$RT::WebPath."/";
+my $url = $RT::WebURL;
 $agent->get($url);
 
 is ($agent->{'status'}, 200, "Loaded a page");

Modified: rt/branches/3.4-RELEASE/lib/t/regression/06mailgateway.t
==============================================================================
--- rt/branches/3.4-RELEASE/lib/t/regression/06mailgateway.t	(original)
+++ rt/branches/3.4-RELEASE/lib/t/regression/06mailgateway.t	Mon May 23 13:04:38 2005
@@ -74,7 +74,7 @@
 
 # {{{ Test new ticket creation by root who is privileged and superuser
 
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate  --debug --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate  --debug --url $RT::WebURL --queue general --action correspond"), "Opened the mailgate - $@");
 print MAIL <<EOF;
 From: root\@localhost
 To: rt\@example.com
@@ -102,7 +102,7 @@
 
 # {{{This is a test of new ticket creation as an unknown user
 
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $RT::WebURL --queue general --action correspond"), "Opened the mailgate - $@");
 print MAIL <<EOF;
 From: doesnotexist\@example.com
 To: rt\@example.com
@@ -138,7 +138,7 @@
 ok ($val, "Granted everybody the right to create tickets - $msg");
 
 
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $RT::WebURL --queue general --action correspond"), "Opened the mailgate - $@");
 print MAIL <<EOF;
 From: doesnotexist\@example.com
 To: rt\@example.com
@@ -171,13 +171,13 @@
 #($val,$msg) = $g->PrincipalObj->GrantRight(Right => 'CreateTicket');
 #ok ($val, "Granted everybody the right to create tickets - $msg");
 
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $RT::WebURL --queue general --action correspond"), "Opened the mailgate - $@");
 print MAIL <<EOF;
 From: doesnotexist-2\@example.com
 To: rt\@example.com
 Subject: [example.com #@{[$tick->Id]}] This is a test of a reply as an unknown user
 
-Blah!
+Blah!  (Should not work.)
 Foob!
 EOF
 close (MAIL);
@@ -196,7 +196,7 @@
 ($val,$msg) = $g->PrincipalObj->GrantRight(Right => 'ReplyToTicket');
 ok ($val, "Granted everybody the right to reply to  tickets - $msg");
 
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $RT::WebURL --queue general --action correspond"), "Opened the mailgate - $@");
 print MAIL <<EOF;
 From: doesnotexist-2\@example.com
 To: rt\@example.com
@@ -222,13 +222,13 @@
 #($val,$msg) = $g->PrincipalObj->GrantRight(Right => 'CreateTicket');
 #ok ($val, "Granted everybody the right to create tickets - $msg");
 
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action comment"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $RT::WebURL --queue general --action comment"), "Opened the mailgate - $@");
 print MAIL <<EOF;
 From: doesnotexist-3\@example.com
 To: rt\@example.com
 Subject: [example.com #@{[$tick->Id]}] This is a test of a comment as an unknown user
 
-Blah!
+Blah!  (Should not work.)
 Foob!
 EOF
 close (MAIL);
@@ -247,7 +247,7 @@
 ($val,$msg) = $g->PrincipalObj->GrantRight(Right => 'CommentOnTicket');
 ok ($val, "Granted everybody the right to reply to  tickets - $msg");
 
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action comment"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $RT::WebURL --queue general --action comment"), "Opened the mailgate - $@");
 print MAIL <<EOF;
 From: doesnotexist-3\@example.com
 To: rt\@example.com
@@ -288,7 +288,7 @@
                 Encoding => 'base64');
 
 # Create a ticket with a binary attachment
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $RT::WebURL --queue general --action correspond"), "Opened the mailgate - $@");
 
 $entity->print(\*MAIL);
 
@@ -333,7 +333,7 @@
 # Grab the binary attachment via the web ui
 my $ua      = LWP::UserAgent->new();
 
-my $full_url = "http://localhost".$RT::WebPath."/Ticket/Attachment/".$attachment->TransactionId."/".$attachment->id."/bplogo.gif?&user=root&pass=password";
+my $full_url = "$RT::WebURL/Ticket/Attachment/".$attachment->TransactionId."/".$attachment->id."/bplogo.gif?&user=root&pass=password";
 my $r = $ua->get( $full_url);
 
 
@@ -346,7 +346,7 @@
 
 # {{{ Simple I18N testing
 
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $RT::WebURL --queue general --action correspond"), "Opened the mailgate - $@");
                                                                          
 print MAIL <<EOF;
 From: root\@localhost
@@ -380,7 +380,7 @@
 ok($unitick->Transactions->First->Attachments->First->Content =~ /$unistring/i, $unitick->Id." appears to be unicode ". $unitick->Transactions->First->Attachments->First->Id);
 # supposedly I18N fails on the second message sent in.
 
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $RT::WebURL --queue general --action correspond"), "Opened the mailgate - $@");
                                                                          
 print MAIL <<EOF;
 From: root\@localhost

Modified: rt/branches/3.4-RELEASE/lib/t/regression/07acl.t
==============================================================================
--- rt/branches/3.4-RELEASE/lib/t/regression/07acl.t	(original)
+++ rt/branches/3.4-RELEASE/lib/t/regression/07acl.t	Mon May 23 13:04:38 2005
@@ -29,10 +29,10 @@
 
 
 # get the top page
-my $url = "http://localhost".$RT::WebPath."/";
+my $url = $RT::WebURL;
 $agent->get($url);
 
-is ($agent->{'status'}, 200, "Loaded a page - http://localhost".$RT::WebPath);
+is ($agent->{'status'}, 200, "Loaded a page - $RT::WebURL");
 # {{{ test a login
 
 # follow the link marked "Login"

Modified: rt/branches/3.4-RELEASE/lib/t/regression/08web_cf_access.t
==============================================================================
--- rt/branches/3.4-RELEASE/lib/t/regression/08web_cf_access.t	(original)
+++ rt/branches/3.4-RELEASE/lib/t/regression/08web_cf_access.t	Mon May 23 13:04:38 2005
@@ -7,8 +7,8 @@
 RT::Init;
 use Test::WWW::Mechanize;
 
-$RT::WebPath ||= ''; # Shut up a warning
-use constant BaseURL => "http://localhost".$RT::WebPath."/";
+$RT::WebURL ||= 0; # avoid stupid warning
+my $BaseURL = $RT::WebURL;
 use constant ImageFile => $RT::MasonComponentRoot .'/NoAuth/images/bplogo.gif';
 use constant ImageFileContent => do {
     local $/;
@@ -20,7 +20,7 @@
 my $m = Test::WWW::Mechanize->new;
 isa_ok($m, 'Test::WWW::Mechanize');
 
-$m->get( BaseURL."?user=root;pass=password" );
+$m->get( $BaseURL."?user=root;pass=password" );
 $m->content_like(qr/Logout/, 'we did log in');
 $m->follow_link( text => 'Configuration' );
 $m->title_is(q/RT Administration/, 'admin screen');
@@ -85,7 +85,7 @@
 $m->follow_link( text => 'bplogo.gif' );
 $m->content_is(ImageFileContent, "it links to the uploaded image");
 
-$m->get( BaseURL );
+$m->get( $BaseURL );
 
 $m->follow_link( text => 'Tickets' );
 $m->follow_link( text => 'New Query' );


More information about the Rt-commit mailing list