hgweb: make the test suite use hgweb in a more WSGI compliant way
authorMads Kiilerich <mads@kiilerich.com>
Sun, 27 Jan 2013 03:32:09 +0100
changeset 18646 c6a81e54c209
parent 18645 76ff3a715cf2
child 18647 c1d23b4a66d5
hgweb: make the test suite use hgweb in a more WSGI compliant way - as checked by wsgiref.validate. This makes sure that we don't optimize hgweb for invalid use cases.
tests/test-extension.t
tests/test-hgweb-no-path-info.t
tests/test-hgweb-no-request-uri.t
--- a/tests/test-extension.t	Sun Feb 10 18:24:29 2013 +0100
+++ b/tests/test-extension.t	Sun Jan 27 03:32:09 2013 +0100
@@ -112,7 +112,8 @@
   > wsgicgi.launch(application)
   > EOF
 
-  $ SCRIPT_NAME='/' SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
+  $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \
+  >    SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
   >    | grep '^[0-9]) ' # ignores HTML output
   1) foo imported
   1) bar imported
--- a/tests/test-hgweb-no-path-info.t	Sun Feb 10 18:24:29 2013 +0100
+++ b/tests/test-hgweb-no-path-info.t	Sun Jan 27 03:32:09 2013 +0100
@@ -39,6 +39,7 @@
   >     'wsgi.multiprocess': False,
   >     'wsgi.run_once': False,
   >     'REQUEST_METHOD': 'GET',
+  >     'PATH_INFO': '/',
   >     'SCRIPT_NAME': '',
   >     'SERVER_NAME': '127.0.0.1',
   >     'SERVER_PORT': os.environ['HGPORT'],
@@ -49,6 +50,7 @@
   >     content = app(env, startrsp)
   >     sys.stdout.write(output.getvalue())
   >     sys.stdout.write(''.join(content))
+  >     getattr(content, 'close', lambda : None)()
   >     print '---- ERRORS'
   >     print errors.getvalue()
   > 
@@ -101,7 +103,7 @@
   [('Content-Type', 'text/plain; charset=ascii')]
   ---- DATA
   
-  repo/
+  /repo/
   
   ---- ERRORS
   
--- a/tests/test-hgweb-no-request-uri.t	Sun Feb 10 18:24:29 2013 +0100
+++ b/tests/test-hgweb-no-request-uri.t	Sun Jan 27 03:32:09 2013 +0100
@@ -49,6 +49,7 @@
   >     content = app(env, startrsp)
   >     sys.stdout.write(output.getvalue())
   >     sys.stdout.write(''.join(content))
+  >     getattr(content, 'close', lambda : None)()
   >     print '---- ERRORS'
   >     print errors.getvalue()
   >