comparison tests/test-clone-cgi.t @ 12410:2bfb335c7594

tests: unify test-clone-cgi
author Matt Mackall <mpm@selenic.com>
date Sun, 26 Sep 2010 13:11:52 -0500
parents tests/test-clone-cgi@1af96b090116
children aa3f726a2bdb
comparison
equal deleted inserted replaced
12409:0eaf7d32a5d8 12410:2bfb335c7594
1 This is a test of the wire protocol over CGI-based hgweb.
2 initialize repository
3
4 $ hg init test
5 $ cd test
6 $ echo a > a
7 $ hg ci -Ama
8 adding a
9 $ cd ..
10 $ cat >hgweb.cgi <<HGWEB
11 > #
12 > # An example CGI script to use hgweb, edit as necessary
13 > import cgitb
14 > cgitb.enable()
15 > from mercurial import demandimport; demandimport.enable()
16 > from mercurial.hgweb import hgweb
17 > from mercurial.hgweb import wsgicgi
18 > application = hgweb("test", "Empty test repository")
19 > wsgicgi.launch(application)
20 > HGWEB
21 $ chmod 755 hgweb.cgi
22 $ DOCUMENT_ROOT="/var/www/hg"; export DOCUMENT_ROOT
23 $ GATEWAY_INTERFACE="CGI/1.1"; export GATEWAY_INTERFACE
24 $ HTTP_ACCEPT="text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; export HTTP_ACCEPT
25 $ HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7"; export HTTP_ACCEPT_CHARSET
26 $ HTTP_ACCEPT_ENCODING="gzip,deflate"; export HTTP_ACCEPT_ENCODING
27 $ HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5"; export HTTP_ACCEPT_LANGUAGE
28 $ HTTP_CACHE_CONTROL="max-age=0"; export HTTP_CACHE_CONTROL
29 $ HTTP_CONNECTION="keep-alive"; export HTTP_CONNECTION
30 $ HTTP_HOST="hg.omnifarious.org"; export HTTP_HOST
31 $ HTTP_KEEP_ALIVE="300"; export HTTP_KEEP_ALIVE
32 $ HTTP_USER_AGENT="Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.4) Gecko/20060608 Ubuntu/dapper-security Firefox/1.5.0.4"; export HTTP_USER_AGENT
33 $ PATH_INFO="/"; export PATH_INFO
34 $ PATH_TRANSLATED="/var/www/hg/index.html"; export PATH_TRANSLATED
35 $ REMOTE_ADDR="127.0.0.2"; export REMOTE_ADDR
36 $ REMOTE_PORT="44703"; export REMOTE_PORT
37 $ REQUEST_METHOD="GET"; export REQUEST_METHOD
38 $ REQUEST_URI="/test/"; export REQUEST_URI
39 $ SCRIPT_FILENAME="/home/hopper/hg_public/test.cgi"; export SCRIPT_FILENAME
40 $ SCRIPT_NAME="/test"; export SCRIPT_NAME
41 $ SCRIPT_URI="http://hg.omnifarious.org/test/"; export SCRIPT_URI
42 $ SCRIPT_URL="/test/"; export SCRIPT_URL
43 $ SERVER_ADDR="127.0.0.1"; export SERVER_ADDR
44 $ SERVER_ADMIN="eric@localhost"; export SERVER_ADMIN
45 $ SERVER_NAME="hg.omnifarious.org"; export SERVER_NAME
46 $ SERVER_PORT="80"; export SERVER_PORT
47 $ SERVER_PROTOCOL="HTTP/1.1"; export SERVER_PROTOCOL
48 $ SERVER_SIGNATURE="<address>Apache/2.0.53 (Fedora) Server at hg.omnifarious.org Port 80</address>"; export SERVER_SIGNATURE
49 $ SERVER_SOFTWARE="Apache/2.0.53 (Fedora)"; export SERVER_SOFTWARE
50
51 try hgweb request
52
53 $ QUERY_STRING="cmd=changegroup&roots=0000000000000000000000000000000000000000"; export QUERY_STRING
54 $ python hgweb.cgi >page1 2>&1
55 $ python "$TESTDIR/md5sum.py" page1
56 1f424bb22ec05c3c6bc866b6e67efe43 page1