Debian Codegraph @

tests/test-hgweb-head.t

raw
1 #require serve
2
3 Some tests for hgweb responding to HEAD requests
4
5 $ hg init test
6 $ cd test
7 $ mkdir da
8 $ echo foo > da/foo
9 $ echo foo > foo
10 $ hg ci -Ambase
11 adding da/foo
12 adding foo
13 $ hg bookmark -r0 '@'
14 $ hg bookmark -r0 'a b c'
15 $ hg bookmark -r0 'd/e/f'
16 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
17 $ cat hg.pid >> $DAEMON_PIDS
18
19 manifest
20
21 $ get-with-headers.py localhost:$HGPORT --method=HEAD 'file/tip/?style=raw' - date etag server
22 200 Script output follows
23 content-type: text/plain; charset=ascii
24
25 $ get-with-headers.py localhost:$HGPORT --method=HEAD 'file/tip/da?style=raw' - date etag server
26 200 Script output follows
27 content-type: text/plain; charset=ascii
28
29
30 plain file
31
32 $ get-with-headers.py localhost:$HGPORT --method=HEAD 'file/tip/foo?style=raw' - date etag server
33 200 Script output follows
34 content-disposition: inline; filename="foo"
35 content-length: 4
36 content-type: application/binary
37
38
39 should give a 404 - static file that does not exist
40
41 $ get-with-headers.py localhost:$HGPORT --method=HEAD 'static/bogus' - date etag server
42 404 Not Found
43 content-type: text/html; charset=ascii
44
45 [1]
46
47 should give a 404 - bad revision
48
49 $ get-with-headers.py localhost:$HGPORT --method=HEAD 'file/spam/foo?style=raw' - date etag server
50 404 Not Found
51 content-type: text/plain; charset=ascii
52
53 [1]
54
55 should give a 400 - bad command
56
57 $ get-with-headers.py localhost:$HGPORT --method=HEAD 'file/tip/foo?cmd=spam&style=raw' - date etag server
58 400* (glob)
59 content-type: text/plain; charset=ascii
60
61 [1]
62
63 should give a 404 - file does not exist
64
65 $ get-with-headers.py localhost:$HGPORT --method=HEAD 'file/tip/bork?style=raw' - date etag server
66 404 Not Found
67 content-type: text/plain; charset=ascii
68
69 [1]
70
71 try bad style
72
73 $ get-with-headers.py localhost:$HGPORT --method=HEAD 'file/tip/?style=foobar' - date etag server
74 200 Script output follows
75 content-type: text/html; charset=ascii
76
77
78 log
79
80 $ get-with-headers.py localhost:$HGPORT --method=HEAD 'log?style=raw' - date etag server
81 200 Script output follows
82 content-type: text/plain; charset=ascii
83
84
85 access bookmarks
86
87 $ get-with-headers.py localhost:$HGPORT --method=HEAD 'rev/@?style=paper' - date etag server
88 200 Script output follows
89 content-type: text/html; charset=ascii
90
91
92 static file
93
94 $ get-with-headers.py localhost:$HGPORT --method=HEAD 'static/style-gitweb.css' - date etag server
95 200 Script output follows
96 content-length: 9074
97 content-type: text/css
98
99
100 $ killdaemons.py
101
102 $ cd ..