tests/test-hgweb-no-path-info.t
changeset 40161 3eea8e83c261
parent 39707 5abc47d4ca6b
child 40203 f80f7a67e176
equal deleted inserted replaced
40160:6037c49b8964 40161:3eea8e83c261
    34   >     print('---- STATUS')
    34   >     print('---- STATUS')
    35   >     print(status)
    35   >     print(status)
    36   >     print('---- HEADERS')
    36   >     print('---- HEADERS')
    37   >     print([i for i in headers if i[0] != 'ETag'])
    37   >     print([i for i in headers if i[0] != 'ETag'])
    38   >     print('---- DATA')
    38   >     print('---- DATA')
       
    39   >     sys.stdout.flush()
    39   >     return output.write
    40   >     return output.write
    40   > 
    41   > 
    41   > env = {
    42   > env = {
    42   >     'wsgi.version': (1, 0),
    43   >     'wsgi.version': (1, 0),
    43   >     'wsgi.url_scheme': 'http',
    44   >     'wsgi.url_scheme': 'http',
    53   >     'SERVER_PORT': os.environ['HGPORT'],
    54   >     'SERVER_PORT': os.environ['HGPORT'],
    54   >     'SERVER_PROTOCOL': 'HTTP/1.0'
    55   >     'SERVER_PROTOCOL': 'HTTP/1.0'
    55   > }
    56   > }
    56   > 
    57   > 
    57   > def process(app):
    58   > def process(app):
       
    59   >     try:
       
    60   >         stdout = sys.stdout.buffer
       
    61   >     except AttributeError:
       
    62   >         stdout = sys.stdout
    58   >     content = app(env, startrsp)
    63   >     content = app(env, startrsp)
    59   >     sys.stdout.write(output.getvalue())
    64   >     stdout.write(output.getvalue())
    60   >     sys.stdout.write(''.join(content))
    65   >     stdout.write(b''.join(content))
       
    66   >     stdout.flush()
    61   >     getattr(content, 'close', lambda : None)()
    67   >     getattr(content, 'close', lambda : None)()
    62   >     print('---- ERRORS')
    68   >     if errors.getvalue():
    63   >     print(errors.getvalue())
    69   >         print('---- ERRORS')
       
    70   >         print(errors.getvalue())
       
    71   >     sys.stdout.flush()
    64   > 
    72   > 
    65   > output = stringio()
    73   > output = stringio()
    66   > env['QUERY_STRING'] = 'style=atom'
    74   > env['QUERY_STRING'] = 'style=atom'
    67   > process(hgweb(b'.', name=b'repo'))
    75   > process(hgweb(b'.', name=b'repo'))
    68   > 
    76   > 
   128      </table>
   136      </table>
   129     </content>
   137     </content>
   130    </entry>
   138    </entry>
   131   
   139   
   132   </feed>
   140   </feed>
   133   ---- ERRORS
       
   134   
       
   135   ---- STATUS
   141   ---- STATUS
   136   200 Script output follows
   142   200 Script output follows
   137   ---- HEADERS
   143   ---- HEADERS
   138   [('Content-Type', 'text/plain; charset=ascii')]
   144   [('Content-Type', 'text/plain; charset=ascii')]
   139   ---- DATA
   145   ---- DATA
   140   
   146   
   141   /repo/
   147   /repo/
   142   
   148   
   143   ---- ERRORS
       
   144   
       
   145 
   149 
   146   $ cd ..
   150   $ cd ..