Here's a patch to various tests to use the new Apache::TestRequest::module2url sub.

This patch is awaiting the outcome of a patch submitted to test-dev@ for Apache::TestRequest::module2url.

-=Chris
Index: t/perl/ithreads2.t
===================================================================
--- t/perl/ithreads2.t  (revision 110069)
+++ t/perl/ithreads2.t  (working copy)
@@ -19,11 +19,7 @@
 }
 
 my $module = 'TestPerl::ithreads';
-my $config = Apache::Test::config();
-my $path = Apache::TestRequest::module2path($module);
+my $url    = Apache::TestRequest::module2url($module);
 
-Apache::TestRequest::module($module);
-my $hostport = Apache::TestRequest::hostport($config);
-
-t_debug("connecting to $hostport");
-print GET_BODY_ASSERT "http://$hostport/$path";;
+t_debug("connecting to $url");
+print GET_BODY_ASSERT $url;
Index: t/modperl/perl_options.t
===================================================================
--- t/modperl/perl_options.t    (revision 110069)
+++ t/modperl/perl_options.t    (working copy)
@@ -5,12 +5,8 @@
 use Apache::TestUtil;
 use Apache::TestRequest;
 
-my $module = "TestModperl::perl_options";
-my $path = Apache::TestRequest::module2path($module);
+my $module = 'TestModperl::perl_options';
+my $url    = Apache::TestRequest::module2url($module);
 
-Apache::TestRequest::module($module);
-my $hostport = Apache::TestRequest::hostport(Apache::Test::config());
-my $location = "http://$hostport/$path";;
-
-t_debug "connecting to $hostport";
-print GET_BODY_ASSERT $location;
+t_debug "connecting to $url";
+print GET_BODY_ASSERT $url;
Index: t/modperl/merge2.t
===================================================================
--- t/modperl/merge2.t  (revision 110069)
+++ t/modperl/merge2.t  (working copy)
@@ -5,20 +5,14 @@
 use Apache::Test;
 use Apache::TestUtil;
 
-my $module   = 'TestModperl::merge';
-Apache::TestRequest::module($module);
+my $module = 'TestModperl::merge';
+my $url    = Apache::TestRequest::module2url($module, {path => '/merge2/'});
 
-my $config   = Apache::Test::config();
-my $hostport = Apache::TestRequest::hostport($config);
-
-my $base = "http://$hostport";;
-
 # test server-to-container merging (with overrides) for:
 #   PerlSetEnv
 #   PerlPassEnv
 #   PerlSetVar
 #   PerlAddVar
 
-my $uri = "$base/merge2/";
-t_debug("connecting to $uri");
-print GET_BODY_ASSERT $uri;
+t_debug("connecting to $url");
+print GET_BODY_ASSERT $url;
Index: t/modperl/merge3.t
===================================================================
--- t/modperl/merge3.t  (revision 110069)
+++ t/modperl/merge3.t  (working copy)
@@ -5,20 +5,14 @@
 use Apache::Test;
 use Apache::TestUtil;
 
-my $module   = 'TestModperl::merge';
-Apache::TestRequest::module($module);
+my $module = 'TestModperl::merge';
+my $url    = Apache::TestRequest::module2url($module, {path => '/merge3/'});
 
-my $config   = Apache::Test::config();
-my $hostport = Apache::TestRequest::hostport($config);
-
-my $base = "http://$hostport";;
-
 # test multi-level merging (server-to-container-to-htaccess) for:
 #   PerlSetEnv
 #   PerlPassEnv
 #   PerlSetVar
 #   PerlAddVar
 
-my $uri = "$base/merge3/";
-t_debug("connecting to $uri");
-print GET_BODY_ASSERT $uri;
+t_debug("connecting to $url");
+print GET_BODY_ASSERT $url;
Index: t/modperl/merge.t
===================================================================
--- t/modperl/merge.t   (revision 110069)
+++ t/modperl/merge.t   (working copy)
@@ -5,20 +5,14 @@
 use Apache::Test;
 use Apache::TestUtil;
 
-my $module   = 'TestModperl::merge';
-Apache::TestRequest::module($module);
+my $module = 'TestModperl::merge';
+my $url    = Apache::TestRequest::module2url($module, {path => '/merge/'});
 
-my $config   = Apache::Test::config();
-my $hostport = Apache::TestRequest::hostport($config);
-
-my $base = "http://$hostport";;
-
 # test server-to-container merging (without overrides) for:
 #   PerlSetEnv
 #   PerlPassEnv
 #   PerlSetVar
 #   PerlAddVar
 
-my $uri = "$base/merge";
-t_debug("connecting to $uri");
-print GET_BODY_ASSERT $uri;
+t_debug("connecting to $url");
+print GET_BODY_ASSERT $url;
Index: t/modperl/setupenv.t
===================================================================
--- t/modperl/setupenv.t        (revision 110069)
+++ t/modperl/setupenv.t        (working copy)
@@ -5,27 +5,21 @@
 use Apache::Test;
 use Apache::TestUtil;
 
-my $module   = "TestModperl::setupenv";
-Apache::TestRequest::module($module);
+my $module = 'TestModperl::setupenv';
+my $url    = Apache::TestRequest::module2url($module);
 
-my $config   = Apache::Test::config();
-my $hostport = Apache::TestRequest::hostport($config);
-my $path     = Apache::TestRequest::module2path($module);
+t_debug("connecting to $url");
 
-my $base = "http://$hostport/$path";;
+my @locations = ("${url}_mpdefault",
+                 "${url}_mpsetup",
+                 "${url}_mpdefault",  # make sure %ENV is cleared
+                 "${url}_mpvoid",
+                 "${url}_mpsetupvoid",
+                 "${url}_psdefault",
+                 "${url}_psnosetup",
+                 "${url}_psvoid",
+                 "${url}_psnosetupvoid");
 
-t_debug("connecting to $base");
-
-my @locations = ("${base}_mpdefault",
-                 "${base}_mpsetup",
-                 "${base}_mpdefault",  # make sure %ENV is cleared
-                 "${base}_mpvoid",
-                 "${base}_mpsetupvoid",
-                 "${base}_psdefault",
-                 "${base}_psnosetup",
-                 "${base}_psvoid",
-                 "${base}_psnosetupvoid");
-
 # plan the tests from a handler so we can run
 # tests from within handlers across multiple requests
 #
@@ -37,7 +31,7 @@
 }
 
 Apache::TestRequest::user_agent(keep_alive => 1);
-print GET_BODY_ASSERT join '?', $base, scalar @locations;
+print GET_BODY_ASSERT join '?', $url, scalar @locations;
 
 # this tests for when %ENV is populated with CGI variables
 # as well as the contents of the subprocess_env table
Index: t/vhost/log.t
===================================================================
--- t/vhost/log.t       (revision 110069)
+++ t/vhost/log.t       (working copy)
@@ -5,11 +5,8 @@
 my $vars = $config->{vars};
 
 my $module = 'TestVhost::log';
-my $path = Apache::TestRequest::module2path($module);
+my $url    = Apache::TestRequest::module2url($module);
 
-Apache::TestRequest::module($module);
-my $hostport = Apache::TestRequest::hostport($config);
+t_debug("connecting to $url");
+print GET_BODY_ASSERT $url;
 
-t_debug("connecting to $hostport");
-print GET_BODY_ASSERT "http://$hostport/$path";;
-
Index: t/vhost/config.t
===================================================================
--- t/vhost/config.t    (revision 110069)
+++ t/vhost/config.t    (working copy)
@@ -8,14 +8,11 @@
 my $vars = $config->{vars};
 
 my $module = 'TestVhost::config';
-my $path = Apache::TestRequest::module2path($module);
+my $url    = Apache::TestRequest::module2url($module);
 
-Apache::TestRequest::module($module);
-my $hostport = Apache::TestRequest::hostport($config);
+t_debug("connecting to $url");
+my $res = GET $url;
 
-t_debug("connecting to $hostport");
-my $res = GET "http://$hostport/$path";;
-
 if ($res->is_success) {
     print $res->content;
 }
Index: t/preconnection/note.t
===================================================================
--- t/preconnection/note.t      (revision 110069)
+++ t/preconnection/note.t      (working copy)
@@ -5,16 +5,15 @@
 use Apache::TestUtil;
 use Apache::TestRequest;
 
-my $module = "TestPreConnection::note";
-Apache::TestRequest::module($module);
+my $module = 'TestPreConnection::note';
+my $url    = Apache::TestRequest::module2url($module);
 my $config = Apache::Test::config();
-my $hostport = Apache::TestRequest::hostport($config);
-my $location = "http://$hostport/"; . Apache::TestRequest::module2path($module);
+
 my $remote_addr = $config->{vars}->{remote_addr};
-t_debug("connecting to $location");
+t_debug("connecting to $url");
 plan tests => 1;
 
 ok t_cmp(
-    GET_BODY_ASSERT($location),
+    GET_BODY_ASSERT($url),
     $remote_addr,
     "connection notes");
Index: t/modules/proxy.t
===================================================================
--- t/modules/proxy.t   (revision 110069)
+++ t/modules/proxy.t   (working copy)
@@ -5,17 +5,14 @@
 use Apache::TestUtil;
 use Apache::TestRequest;
 
-my $module = 'TestModules::proxy';
+my $module = 'TestModperl::merge';
+my $url    = Apache::TestRequest::module2url($module);
 
-Apache::TestRequest::module($module);
-my $path     = Apache::TestRequest::module2path($module);
-my $config   = Apache::Test::config();
-my $hostport = Apache::TestRequest::hostport($config);
-t_debug("connecting to $hostport");
+t_debug("connecting to $url");
 
 plan tests => 1, (need_module('proxy') &&
                   need_access);
 
 my $expected = "ok";
-my $received = GET_BODY_ASSERT "http://$hostport/$path";;;
+my $received = GET_BODY_ASSERT $url;
 ok t_cmp($received, $expected, "internally proxified request");
Index: t/user/rewrite.t
===================================================================
--- t/user/rewrite.t    (revision 110069)
+++ t/user/rewrite.t    (working copy)
@@ -6,11 +6,7 @@
 use Apache::TestUtil;
 
 my $module = 'TestUser::rewrite';
+my $url    = Apache::TestRequest::module2url($module);
 
-Apache::TestRequest::module($module);
-my $path     = Apache::TestRequest::module2path($module);
-my $config   = Apache::Test::config();
-my $hostport = Apache::TestRequest::hostport($config);
-t_debug("connecting to $hostport");
-
-print GET_BODY_ASSERT "http://$hostport/$path";;
+t_debug("connecting to $url");
+print GET_BODY_ASSERT $url;

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to