Mercurial > hg
annotate tests/test-newcgi.t @ 14524:97d2259af787
prepush: eliminate 'if branch'
branch is always set anyway
No change in program behavior.
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Fri, 03 Jun 2011 11:26:43 +0200 |
parents | aa3f726a2bdb |
children | 8b84d040d9f9 |
rev | line source |
---|---|
12470 | 1 This tests if CGI files from after d0db3462d568 but |
2 before d74fc8dec2b4 still work. | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
3 |
12470 | 4 $ hg init test |
5 $ cat >hgweb.cgi <<HGWEB | |
6 > #!/usr/bin/env python | |
7 > # | |
8 > # An example CGI script to use hgweb, edit as necessary | |
9 > | |
10 > import cgitb | |
11 > cgitb.enable() | |
12 > | |
13 > from mercurial import demandimport; demandimport.enable() | |
14 > from mercurial.hgweb import hgweb | |
15 > from mercurial.hgweb import wsgicgi | |
16 > from mercurial.hgweb.request import wsgiapplication | |
17 > | |
18 > def make_web_app(): | |
12743
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12470
diff
changeset
|
19 > return hgweb("test", "Empty test repository") |
12470 | 20 > |
21 > wsgicgi.launch(wsgiapplication(make_web_app)) | |
22 > HGWEB | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
23 |
12470 | 24 $ chmod 755 hgweb.cgi |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
25 |
12470 | 26 $ cat >hgweb.config <<HGWEBDIRCONF |
27 > [paths] | |
28 > test = test | |
29 > HGWEBDIRCONF | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
30 |
12470 | 31 $ cat >hgwebdir.cgi <<HGWEBDIR |
32 > #!/usr/bin/env python | |
33 > # | |
34 > # An example CGI script to export multiple hgweb repos, edit as necessary | |
35 > | |
36 > import cgitb | |
37 > cgitb.enable() | |
38 > | |
39 > from mercurial import demandimport; demandimport.enable() | |
40 > from mercurial.hgweb import hgwebdir | |
41 > from mercurial.hgweb import wsgicgi | |
42 > from mercurial.hgweb.request import wsgiapplication | |
43 > | |
44 > def make_web_app(): | |
12743
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12470
diff
changeset
|
45 > return hgwebdir("hgweb.config") |
12470 | 46 > |
47 > wsgicgi.launch(wsgiapplication(make_web_app)) | |
48 > HGWEBDIR | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
49 |
12470 | 50 $ chmod 755 hgwebdir.cgi |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
51 |
13269
aa3f726a2bdb
tests: remove duplication of the CGI environment variables
StevenGBrown
parents:
12743
diff
changeset
|
52 $ . "$TESTDIR/cgienv" |
12470 | 53 $ python hgweb.cgi > page1 |
54 $ python hgwebdir.cgi > page2 | |
55 | |
56 $ PATH_INFO="/test/" | |
57 $ PATH_TRANSLATED="/var/something/test.cgi" | |
58 $ REQUEST_URI="/test/test/" | |
59 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/" | |
60 $ SCRIPT_URL="/test/test/" | |
61 $ python hgwebdir.cgi > page3 | |
62 | |
63 $ grep -i error page1 page2 page3 | |
64 [1] |