author | Brodie Rao <brodie@bitheap.org> |
Mon, 04 Oct 2010 15:07:12 -0500 | |
changeset 12637 | 42ca7aef28d3 |
parent 12432 | 7f3af5da4e6c |
child 12666 | ead4e21f49f1 |
permissions | -rw-r--r-- |
12432 | 1 |
Some tests for hgweb. Tests static files, plain files and different 404's. |
2 |
||
3 |
$ hg init test |
|
4 |
$ cd test |
|
5 |
$ mkdir da |
|
6 |
$ echo foo > da/foo |
|
7 |
$ echo foo > foo |
|
8 |
$ hg ci -Ambase |
|
9 |
adding da/foo |
|
10 |
adding foo |
|
11 |
$ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
12 |
$ cat hg.pid >> $DAEMON_PIDS |
|
13 |
||
14 |
manifest |
|
3942 | 15 |
|
12432 | 16 |
$ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw') |
17 |
200 Script output follows |
|
18 |
||
19 |
||
20 |
drwxr-xr-x da |
|
21 |
-rw-r--r-- 4 foo |
|
22 |
||
23 |
||
24 |
$ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/da?style=raw') |
|
25 |
200 Script output follows |
|
26 |
||
27 |
||
28 |
-rw-r--r-- 4 foo |
|
29 |
||
30 |
||
31 |
||
32 |
plain file |
|
33 |
||
34 |
$ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?style=raw' |
|
35 |
200 Script output follows |
|
36 |
||
37 |
foo |
|
38 |
||
39 |
should give a 404 - static file that does not exist |
|
9842
d3dbdca92458
hgweb: don't choke when an inexistent style is requested (issue1901)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8167
diff
changeset
|
40 |
|
12432 | 41 |
$ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/bogus' |
42 |
404 Not Found |
|
43 |
||
44 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
45 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
46 |
<head> |
|
47 |
<link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
48 |
<meta name="robots" content="index, nofollow" /> |
|
49 |
<link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
50 |
||
51 |
<title>test: error</title> |
|
52 |
</head> |
|
53 |
<body> |
|
54 |
||
55 |
<div class="container"> |
|
56 |
<div class="menu"> |
|
57 |
<div class="logo"> |
|
58 |
<a href="http://mercurial.selenic.com/"> |
|
59 |
<img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a> |
|
60 |
</div> |
|
61 |
<ul> |
|
62 |
<li><a href="/shortlog">log</a></li> |
|
63 |
<li><a href="/graph">graph</a></li> |
|
64 |
<li><a href="/tags">tags</a></li> |
|
65 |
<li><a href="/branches">branches</a></li> |
|
66 |
</ul> |
|
67 |
</div> |
|
68 |
||
69 |
<div class="main"> |
|
70 |
||
71 |
<h2><a href="/">test</a></h2> |
|
72 |
<h3>error</h3> |
|
73 |
||
74 |
<form class="search" action="/log"> |
|
75 |
||
76 |
<p><input name="rev" id="search1" type="text" size="30"></p> |
|
77 |
<div id="hint">find changesets by author, revision, |
|
78 |
files, or words in the commit message</div> |
|
79 |
</form> |
|
80 |
||
81 |
<div class="description"> |
|
82 |
<p> |
|
83 |
An error occurred while processing your request: |
|
84 |
</p> |
|
85 |
<p> |
|
86 |
Not Found |
|
87 |
</p> |
|
88 |
</div> |
|
89 |
</div> |
|
90 |
</div> |
|
91 |
||
92 |
||
93 |
||
94 |
</body> |
|
95 |
</html> |
|
96 |
||
97 |
[1] |
|
98 |
||
99 |
should give a 404 - bad revision |
|
100 |
||
101 |
$ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/spam/foo?style=raw' |
|
102 |
404 Not Found |
|
103 |
||
104 |
||
105 |
error: revision not found: spam |
|
106 |
[1] |
|
107 |
||
108 |
should give a 400 - bad command |
|
9842
d3dbdca92458
hgweb: don't choke when an inexistent style is requested (issue1901)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8167
diff
changeset
|
109 |
|
12432 | 110 |
$ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?cmd=spam&style=raw' |
111 |
400* (glob) |
|
112 |
||
113 |
||
114 |
error: no such method: spam |
|
115 |
[1] |
|
116 |
||
117 |
should give a 404 - file does not exist |
|
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
118 |
|
12432 | 119 |
$ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork?style=raw' |
120 |
404 Not Found |
|
121 |
||
122 |
||
123 |
error: bork@2ef0ac749a14: not found in manifest |
|
124 |
[1] |
|
125 |
$ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork' |
|
126 |
404 Not Found |
|
127 |
||
128 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
129 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
130 |
<head> |
|
131 |
<link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
132 |
<meta name="robots" content="index, nofollow" /> |
|
133 |
<link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
134 |
||
135 |
<title>test: error</title> |
|
136 |
</head> |
|
137 |
<body> |
|
138 |
||
139 |
<div class="container"> |
|
140 |
<div class="menu"> |
|
141 |
<div class="logo"> |
|
142 |
<a href="http://mercurial.selenic.com/"> |
|
143 |
<img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a> |
|
144 |
</div> |
|
145 |
<ul> |
|
146 |
<li><a href="/shortlog">log</a></li> |
|
147 |
<li><a href="/graph">graph</a></li> |
|
148 |
<li><a href="/tags">tags</a></li> |
|
149 |
<li><a href="/branches">branches</a></li> |
|
150 |
</ul> |
|
151 |
</div> |
|
152 |
||
153 |
<div class="main"> |
|
154 |
||
155 |
<h2><a href="/">test</a></h2> |
|
156 |
<h3>error</h3> |
|
157 |
||
158 |
<form class="search" action="/log"> |
|
159 |
||
160 |
<p><input name="rev" id="search1" type="text" size="30"></p> |
|
161 |
<div id="hint">find changesets by author, revision, |
|
162 |
files, or words in the commit message</div> |
|
163 |
</form> |
|
164 |
||
165 |
<div class="description"> |
|
166 |
<p> |
|
167 |
An error occurred while processing your request: |
|
168 |
</p> |
|
169 |
<p> |
|
170 |
bork@2ef0ac749a14: not found in manifest |
|
171 |
</p> |
|
172 |
</div> |
|
173 |
</div> |
|
174 |
</div> |
|
175 |
||
176 |
||
177 |
||
178 |
</body> |
|
179 |
</html> |
|
180 |
||
181 |
[1] |
|
182 |
$ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/bork?style=raw' |
|
183 |
404 Not Found |
|
184 |
||
185 |
||
186 |
error: bork@2ef0ac749a14: not found in manifest |
|
187 |
[1] |
|
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
188 |
|
12432 | 189 |
try bad style |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
190 |
|
12432 | 191 |
$ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=foobar') |
192 |
200 Script output follows |
|
193 |
||
194 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
195 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
196 |
<head> |
|
197 |
<link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
198 |
<meta name="robots" content="index, nofollow" /> |
|
199 |
<link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
200 |
||
201 |
<title>test: 2ef0ac749a14 /</title> |
|
202 |
</head> |
|
203 |
<body> |
|
204 |
||
205 |
<div class="container"> |
|
206 |
<div class="menu"> |
|
207 |
<div class="logo"> |
|
208 |
<a href="http://mercurial.selenic.com/"> |
|
209 |
<img src="/static/hglogo.png" alt="mercurial" /></a> |
|
210 |
</div> |
|
211 |
<ul> |
|
212 |
<li><a href="/shortlog/2ef0ac749a14">log</a></li> |
|
213 |
<li><a href="/graph/2ef0ac749a14">graph</a></li> |
|
214 |
<li><a href="/tags">tags</a></li> |
|
215 |
<li><a href="/branches">branches</a></li> |
|
216 |
</ul> |
|
217 |
<ul> |
|
218 |
<li><a href="/rev/2ef0ac749a14">changeset</a></li> |
|
219 |
<li class="active">browse</li> |
|
220 |
</ul> |
|
221 |
<ul> |
|
222 |
||
223 |
</ul> |
|
224 |
</div> |
|
225 |
||
226 |
<div class="main"> |
|
227 |
<h2><a href="/">test</a></h2> |
|
228 |
<h3>directory / @ 0:2ef0ac749a14 <span class="tag">tip</span> </h3> |
|
229 |
||
230 |
<form class="search" action="/log"> |
|
231 |
||
232 |
<p><input name="rev" id="search1" type="text" size="30" /></p> |
|
233 |
<div id="hint">find changesets by author, revision, |
|
234 |
files, or words in the commit message</div> |
|
235 |
</form> |
|
236 |
||
237 |
<table class="bigtable"> |
|
238 |
<tr> |
|
239 |
<th class="name">name</th> |
|
240 |
<th class="size">size</th> |
|
241 |
<th class="permissions">permissions</th> |
|
242 |
</tr> |
|
243 |
<tr class="fileline parity0"> |
|
244 |
<td class="name"><a href="/file/2ef0ac749a14/">[up]</a></td> |
|
245 |
<td class="size"></td> |
|
246 |
<td class="permissions">drwxr-xr-x</td> |
|
247 |
</tr> |
|
248 |
||
249 |
<tr class="fileline parity1"> |
|
250 |
<td class="name"> |
|
251 |
<a href="/file/2ef0ac749a14/da"> |
|
252 |
<img src="/static/coal-folder.png" alt="dir."/> da/ |
|
253 |
</a> |
|
254 |
<a href="/file/2ef0ac749a14/da/"> |
|
255 |
||
256 |
</a> |
|
257 |
</td> |
|
258 |
<td class="size"></td> |
|
259 |
<td class="permissions">drwxr-xr-x</td> |
|
260 |
</tr> |
|
261 |
||
262 |
<tr class="fileline parity0"> |
|
263 |
<td class="filename"> |
|
264 |
<a href="/file/2ef0ac749a14/foo"> |
|
265 |
<img src="/static/coal-file.png" alt="file"/> foo |
|
266 |
</a> |
|
267 |
</td> |
|
268 |
<td class="size">4</td> |
|
269 |
<td class="permissions">-rw-r--r--</td> |
|
270 |
</tr> |
|
271 |
</table> |
|
272 |
</div> |
|
273 |
</div> |
|
274 |
||
275 |
||
276 |
</body> |
|
277 |
</html> |
|
278 |
||
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
279 |
|
12432 | 280 |
stop and restart |
281 |
||
282 |
$ "$TESTDIR/killdaemons.py" |
|
283 |
$ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log |
|
284 |
$ cat hg.pid >> $DAEMON_PIDS |
|
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
285 |
|
12432 | 286 |
Test the access/error files are opened in append mode |
287 |
||
288 |
$ python -c "print len(file('access.log').readlines()), 'log lines written'" |
|
289 |
10 log lines written |
|
290 |
||
291 |
static file |
|
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
292 |
|
12432 | 293 |
$ "$TESTDIR/get-with-headers.py" --twice localhost:$HGPORT '/static/style-gitweb.css' |
294 |
200 Script output follows |
|
295 |
||
296 |
body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid #d9d8d1; border-width:1px; margin:10px; } |
|
297 |
a { color:#0000cc; } |
|
298 |
a:hover, a:visited, a:active { color:#880000; } |
|
299 |
div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; } |
|
300 |
div.page_header a:visited { color:#0000cc; } |
|
301 |
div.page_header a:hover { color:#880000; } |
|
302 |
div.page_nav { padding:8px; } |
|
303 |
div.page_nav a:visited { color:#0000cc; } |
|
304 |
div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px} |
|
305 |
div.page_footer { padding:4px 8px; background-color: #d9d8d1; } |
|
306 |
div.page_footer_text { float:left; color:#555555; font-style:italic; } |
|
307 |
div.page_body { padding:8px; } |
|
308 |
div.title, a.title { |
|
309 |
display:block; padding:6px 8px; |
|
310 |
font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000; |
|
311 |
} |
|
312 |
a.title:hover { background-color: #d9d8d1; } |
|
313 |
div.title_text { padding:6px 0px; border: solid #d9d8d1; border-width:0px 0px 1px; } |
|
314 |
div.log_body { padding:8px 8px 8px 150px; } |
|
315 |
.age { white-space:nowrap; } |
|
316 |
span.age { position:relative; float:left; width:142px; font-style:italic; } |
|
317 |
div.log_link { |
|
318 |
padding:0px 8px; |
|
319 |
font-size:10px; font-family:sans-serif; font-style:normal; |
|
320 |
position:relative; float:left; width:136px; |
|
321 |
} |
|
322 |
div.list_head { padding:6px 8px 4px; border:solid #d9d8d1; border-width:1px 0px 0px; font-style:italic; } |
|
323 |
a.list { text-decoration:none; color:#000000; } |
|
324 |
a.list:hover { text-decoration:underline; color:#880000; } |
|
325 |
table { padding:8px 4px; } |
|
326 |
th { padding:2px 5px; font-size:12px; text-align:left; } |
|
327 |
tr.light:hover, .parity0:hover { background-color:#edece6; } |
|
328 |
tr.dark, .parity1 { background-color:#f6f6f0; } |
|
329 |
tr.dark:hover, .parity1:hover { background-color:#edece6; } |
|
330 |
td { padding:2px 5px; font-size:12px; vertical-align:top; } |
|
331 |
td.closed { background-color: #99f; } |
|
332 |
td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; } |
|
333 |
td.indexlinks { white-space: nowrap; } |
|
334 |
td.indexlinks a { |
|
335 |
padding: 2px 5px; line-height: 10px; |
|
336 |
border: 1px solid; |
|
337 |
color: #ffffff; background-color: #7777bb; |
|
338 |
border-color: #aaaadd #333366 #333366 #aaaadd; |
|
339 |
font-weight: bold; text-align: center; text-decoration: none; |
|
340 |
font-size: 10px; |
|
341 |
} |
|
342 |
td.indexlinks a:hover { background-color: #6666aa; } |
|
343 |
div.pre { font-family:monospace; font-size:12px; white-space:pre; } |
|
344 |
div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; } |
|
345 |
div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; } |
|
346 |
div.search { margin:4px 8px; position:absolute; top:56px; right:12px } |
|
347 |
.linenr { color:#999999; text-decoration:none } |
|
348 |
div.rss_logo { float: right; white-space: nowrap; } |
|
349 |
div.rss_logo a { |
|
350 |
padding:3px 6px; line-height:10px; |
|
351 |
border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e; |
|
352 |
color:#ffffff; background-color:#ff6600; |
|
353 |
font-weight:bold; font-family:sans-serif; font-size:10px; |
|
354 |
text-align:center; text-decoration:none; |
|
355 |
} |
|
356 |
div.rss_logo a:hover { background-color:#ee5500; } |
|
357 |
pre { margin: 0; } |
|
358 |
span.logtags span { |
|
359 |
padding: 0px 4px; |
|
360 |
font-size: 10px; |
|
361 |
font-weight: normal; |
|
362 |
border: 1px solid; |
|
363 |
background-color: #ffaaff; |
|
364 |
border-color: #ffccff #ff00ee #ff00ee #ffccff; |
|
365 |
} |
|
366 |
span.logtags span.tagtag { |
|
367 |
background-color: #ffffaa; |
|
368 |
border-color: #ffffcc #ffee00 #ffee00 #ffffcc; |
|
369 |
} |
|
370 |
span.logtags span.branchtag { |
|
371 |
background-color: #aaffaa; |
|
372 |
border-color: #ccffcc #00cc33 #00cc33 #ccffcc; |
|
373 |
} |
|
374 |
span.logtags span.inbranchtag { |
|
375 |
background-color: #d5dde6; |
|
376 |
border-color: #e3ecf4 #9398f4 #9398f4 #e3ecf4; |
|
377 |
} |
|
378 |
||
379 |
/* Graph */ |
|
380 |
div#wrapper { |
|
381 |
position: relative; |
|
382 |
margin: 0; |
|
383 |
padding: 0; |
|
384 |
margin-top: 3px; |
|
385 |
} |
|
386 |
||
387 |
canvas { |
|
388 |
position: absolute; |
|
389 |
z-index: 5; |
|
390 |
top: -0.9em; |
|
391 |
margin: 0; |
|
392 |
} |
|
393 |
||
394 |
ul#nodebgs { |
|
395 |
list-style: none inside none; |
|
396 |
padding: 0; |
|
397 |
margin: 0; |
|
398 |
top: -0.7em; |
|
399 |
} |
|
400 |
||
401 |
ul#graphnodes li, ul#nodebgs li { |
|
402 |
height: 39px; |
|
403 |
} |
|
404 |
||
405 |
ul#graphnodes { |
|
406 |
position: absolute; |
|
407 |
z-index: 10; |
|
408 |
top: -0.8em; |
|
409 |
list-style: none inside none; |
|
410 |
padding: 0; |
|
411 |
} |
|
412 |
||
413 |
ul#graphnodes li .info { |
|
414 |
display: block; |
|
415 |
font-size: 100%; |
|
416 |
position: relative; |
|
417 |
top: -3px; |
|
418 |
font-style: italic; |
|
419 |
} |
|
420 |
304 Not Modified |
|
421 |
||
9842
d3dbdca92458
hgweb: don't choke when an inexistent style is requested (issue1901)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8167
diff
changeset
|
422 |
|
12432 | 423 |
errors |
5690
1b365c5723bc
server: append to logfiles
Mirko Friedenhagen <mirko-lists@friedenhagen.de>
parents:
5580
diff
changeset
|
424 |
|
12432 | 425 |
$ cat errors.log |