Patchwork [2,of,2] tests: use cgienv to minimize environment setup at hgweb tests

login
register
mail settings
Submitter Katsunori FUJIWARA
Date June 26, 2017, 8:21 p.m.
Message ID <9ad22e98645b02e8b85d.1498508502@speaknoevil>
Download mbox | patch
Permalink /patch/21751/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - June 26, 2017, 8:21 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1498497878 -32400
#      Tue Jun 27 02:24:38 2017 +0900
# Node ID 9ad22e98645b02e8b85d7e190633d1d1b07e0529
# Parent  c31f122d54b6904e1fb212c2e14b162fbb977153
tests: use cgienv to minimize environment setup at hgweb tests

This patch follows other hgweb tests.

Patch

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -116,9 +116,9 @@  Check hgweb's load order of extensions a
   > application = hgweb('.', 'test repo')
   > wsgicgi.launch(application)
   > EOF
-
-  $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \
-  >    SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
+  $ . "$TESTDIR/cgienv"
+
+  $ PATH_INFO='/' SCRIPT_NAME='' python hgweb.cgi \
   >    | grep '^[0-9]) ' # ignores HTML output
   1) foo imported
   1) bar imported
@@ -137,9 +137,7 @@  Check hgweb's load order of extensions a
   $ PATH_INFO='/shortlog'
 #endif
   $ export PATH_INFO
-  $ REQUEST_METHOD='GET' SCRIPT_NAME='' \
-  >     QUERY_STRING='rev=foo() and bar()' \
-  >     SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
+  $ SCRIPT_NAME='' QUERY_STRING='rev=foo() and bar()' python hgweb.cgi \
   >     | grep '<a href="/rev/[0-9a-z]*">'
      <a href="/rev/c24b9ac61126">add file</a>
 
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -222,13 +222,9 @@  Test largefiles can be loaded in hgweb (
   > application = hgweb('.', 'test repo')
   > wsgicgi.launch(application)
   > EOF
-
-  $ PATH_INFO='/' \
-  > QUERY_STRING='' \
-  > REQUEST_METHOD='GET' \
-  > SCRIPT_NAME='' \
-  > SERVER_NAME='localhost' \
-  > SERVER_PORT='80' \
+  $ . "$TESTDIR/cgienv"
+
+  $ SCRIPT_NAME='' \
   > python "$TESTTMP/hgweb.cgi" > /dev/null
 
 Test archiving the various revisions.  These hit corner cases known with