Debian Codegraph @

tests/test-newercgi.t

raw
1 #require no-msys # MSYS will translate web paths as if they were file paths
2
3 This is a rudimentary test of the CGI files as of d74fc8dec2b4.
4
5 $ hg init test
6
7 $ cat >hgweb.cgi <<HGWEB
8 > #!$PYTHON
9 > #
10 > # An example CGI script to use hgweb, edit as necessary
11 >
12 > from mercurial import demandimport; demandimport.enable()
13 > from mercurial.hgweb import hgweb
14 > from mercurial.hgweb import wsgicgi
15 >
16 > application = hgweb(b"test", b"Empty test repository")
17 > wsgicgi.launch(application)
18 > HGWEB
19
20 $ chmod 755 hgweb.cgi
21
22 $ cat >hgweb.config <<HGWEBDIRCONF
23 > [paths]
24 > test = test
25 > HGWEBDIRCONF
26
27 $ cat >hgwebdir.cgi <<HGWEBDIR
28 > #!$PYTHON
29 > #
30 > # An example CGI script to export multiple hgweb repos, edit as necessary
31 >
32 > from mercurial import demandimport; demandimport.enable()
33 > from mercurial.hgweb import hgwebdir
34 > from mercurial.hgweb import wsgicgi
35 >
36 > application = hgwebdir(b"hgweb.config")
37 > wsgicgi.launch(application)
38 > HGWEBDIR
39
40 $ chmod 755 hgwebdir.cgi
41
42 $ . "$TESTDIR/cgienv"
43 $ "$PYTHON" hgweb.cgi > page1
44 $ "$PYTHON" hgwebdir.cgi > page2
45
46 $ PATH_INFO="/test/"
47 $ PATH_TRANSLATED="/var/something/test.cgi"
48 $ REQUEST_URI="/test/test/"
49 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
50 $ SCRIPT_URL="/test/test/"
51 $ "$PYTHON" hgwebdir.cgi > page3
52
53 $ grep -i error page1 page2 page3
54 [1]