Mercurial > hg
annotate tests/test-hgweb-no-path-info.t @ 20186:f5b461a4bc55
branchmap: introduce branchtip() method
author | Brodie Rao <brodie@sf.io> |
---|---|
date | Mon, 16 Sep 2013 01:08:29 -0700 |
parents | c6a81e54c209 |
children | d70703954a2a |
rev | line source |
---|---|
12438
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
1 This tests if hgweb and hgwebdir still work if the REQUEST_URI variable is |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
2 no longer passed with the request. Instead, SCRIPT_NAME and PATH_INFO |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
3 should be used from d74fc8dec2b4 onward to route the request. |
6459
8189e03adb44
hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
4 |
13956
ffb5c09ba822
tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents:
12743
diff
changeset
|
5 $ hg init repo |
12438
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
6 $ cd repo |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
7 $ echo foo > bar |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
8 $ hg add bar |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
9 $ hg commit -m "test" |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
10 $ hg tip |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
11 changeset: 0:61c9426e69fe |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
12 tag: tip |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
13 user: test |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
14 date: Thu Jan 01 00:00:00 1970 +0000 |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
15 summary: test |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
16 |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
17 $ cat > request.py <<EOF |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
18 > from mercurial.hgweb import hgweb, hgwebdir |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
19 > from StringIO import StringIO |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
20 > import os, sys |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
21 > |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
22 > errors = StringIO() |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
23 > input = StringIO() |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
24 > |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
25 > def startrsp(status, headers): |
12743
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
26 > print '---- STATUS' |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
27 > print status |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
28 > print '---- HEADERS' |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
29 > print [i for i in headers if i[0] != 'ETag'] |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
30 > print '---- DATA' |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
31 > return output.write |
12438
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
32 > |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
33 > env = { |
12743
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
34 > 'wsgi.version': (1, 0), |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
35 > 'wsgi.url_scheme': 'http', |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
36 > 'wsgi.errors': errors, |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
37 > 'wsgi.input': input, |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
38 > 'wsgi.multithread': False, |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
39 > 'wsgi.multiprocess': False, |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
40 > 'wsgi.run_once': False, |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
41 > 'REQUEST_METHOD': 'GET', |
18646
c6a81e54c209
hgweb: make the test suite use hgweb in a more WSGI compliant way
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
42 > 'PATH_INFO': '/', |
12743
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
43 > 'SCRIPT_NAME': '', |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
44 > 'SERVER_NAME': '127.0.0.1', |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
45 > 'SERVER_PORT': os.environ['HGPORT'], |
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12643
diff
changeset
|
46 > 'SERVER_PROTOCOL': 'HTTP/1.0' |
12438
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
47 > } |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
48 > |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
49 > def process(app): |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
50 > content = app(env, startrsp) |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
51 > sys.stdout.write(output.getvalue()) |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
52 > sys.stdout.write(''.join(content)) |
18646
c6a81e54c209
hgweb: make the test suite use hgweb in a more WSGI compliant way
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
53 > getattr(content, 'close', lambda : None)() |
12438
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
54 > print '---- ERRORS' |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
55 > print errors.getvalue() |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
56 > |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
57 > output = StringIO() |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
58 > env['QUERY_STRING'] = 'style=atom' |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
59 > process(hgweb('.', name='repo')) |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
60 > |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
61 > output = StringIO() |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
62 > env['QUERY_STRING'] = 'style=raw' |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
63 > process(hgwebdir({'repo': '.'})) |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
64 > EOF |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
65 $ python request.py |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
66 ---- STATUS |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
67 200 Script output follows |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
68 ---- HEADERS |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
69 [('Content-Type', 'application/atom+xml; charset=ascii')] |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
70 ---- DATA |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
71 <?xml version="1.0" encoding="ascii"?> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
72 <feed xmlns="http://www.w3.org/2005/Atom"> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
73 <!-- Changelog --> |
12643
d08bb64888bc
tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12438
diff
changeset
|
74 <id>http://127.0.0.1:$HGPORT/</id> |
d08bb64888bc
tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12438
diff
changeset
|
75 <link rel="self" href="http://127.0.0.1:$HGPORT/atom-log"/> |
d08bb64888bc
tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12438
diff
changeset
|
76 <link rel="alternate" href="http://127.0.0.1:$HGPORT/"/> |
12438
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
77 <title>repo Changelog</title> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
78 <updated>1970-01-01T00:00:00+00:00</updated> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
79 |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
80 <entry> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
81 <title>test</title> |
12643
d08bb64888bc
tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12438
diff
changeset
|
82 <id>http://127.0.0.1:$HGPORT/#changeset-61c9426e69fef294feed5e2bbfc97d39944a5b1c</id> |
d08bb64888bc
tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12438
diff
changeset
|
83 <link href="http://127.0.0.1:$HGPORT/rev/61c9426e69fe"/> |
12438
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
84 <author> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
85 <name>test</name> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
86 <email>test</email> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
87 </author> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
88 <updated>1970-01-01T00:00:00+00:00</updated> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
89 <published>1970-01-01T00:00:00+00:00</published> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
90 <content type="xhtml"> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
91 <div xmlns="http://www.w3.org/1999/xhtml"> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
92 <pre xml:space="preserve">test</pre> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
93 </div> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
94 </content> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
95 </entry> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
96 |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
97 </feed> |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
98 ---- ERRORS |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
99 |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
100 ---- STATUS |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
101 200 Script output follows |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
102 ---- HEADERS |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
103 [('Content-Type', 'text/plain; charset=ascii')] |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
104 ---- DATA |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
105 |
18646
c6a81e54c209
hgweb: make the test suite use hgweb in a more WSGI compliant way
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
106 /repo/ |
12438
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
107 |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
108 ---- ERRORS |
922d2078017a
tests: unify test-hgweb-no-path-info
Matt Mackall <mpm@selenic.com>
parents:
12183
diff
changeset
|
109 |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
13956
diff
changeset
|
110 |
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
13956
diff
changeset
|
111 $ cd .. |