Mercurial > hg
annotate tests/test-newercgi.t @ 15284:ebeac9c41456 stable
merge with crew
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 16 Oct 2011 22:15:43 -0500 |
parents | aa3f726a2bdb |
children | 8b84d040d9f9 |
rev | line source |
---|---|
12471 | 1 This is a rudimentary test of the CGI files as of d74fc8dec2b4. |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
2 |
12471 | 3 $ hg init test |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
4 |
12471 | 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 > | |
17 > application = hgweb("test", "Empty test repository") | |
18 > wsgicgi.launch(application) | |
19 > HGWEB | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
20 |
12471 | 21 $ chmod 755 hgweb.cgi |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
22 |
12471 | 23 $ cat >hgweb.config <<HGWEBDIRCONF |
24 > [paths] | |
25 > test = test | |
26 > HGWEBDIRCONF | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
27 |
12471 | 28 $ cat >hgwebdir.cgi <<HGWEBDIR |
29 > #!/usr/bin/env python | |
30 > # | |
31 > # An example CGI script to export multiple hgweb repos, edit as necessary | |
32 > | |
33 > import cgitb | |
34 > cgitb.enable() | |
35 > | |
36 > from mercurial import demandimport; demandimport.enable() | |
37 > from mercurial.hgweb import hgwebdir | |
38 > from mercurial.hgweb import wsgicgi | |
39 > | |
40 > application = hgwebdir("hgweb.config") | |
41 > wsgicgi.launch(application) | |
42 > HGWEBDIR | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
43 |
12471 | 44 $ chmod 755 hgwebdir.cgi |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
45 |
13269
aa3f726a2bdb
tests: remove duplication of the CGI environment variables
StevenGBrown
parents:
12471
diff
changeset
|
46 $ . "$TESTDIR/cgienv" |
12471 | 47 $ python hgweb.cgi > page1 |
48 $ python hgwebdir.cgi > page2 | |
49 | |
50 $ PATH_INFO="/test/" | |
51 $ PATH_TRANSLATED="/var/something/test.cgi" | |
52 $ REQUEST_URI="/test/test/" | |
53 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/" | |
54 $ SCRIPT_URL="/test/test/" | |
55 $ python hgwebdir.cgi > page3 | |
56 | |
57 $ grep -i error page1 page2 page3 | |
58 [1] |