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