Mercurial > hg
annotate tests/test-hgweb.t @ 12723:eaa09d25e7c6
keyword: code cleanup
- move preselection of expansion candidates for rollback
and record into helper function
- same overwrite order in rollback and record:
1. modified, 2. added
- self.wlock() inside kwrepo class instead of repo.wlock()
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Tue, 12 Oct 2010 12:49:23 +0100 |
parents | d664547ef540 |
children | 4b334f8c941b |
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> |
12680
d664547ef540
hgweb: add help link to templates missed in ead4e21f49f1
Augie Fackler <durin42@gmail.com>
parents:
12666
diff
changeset
|
229 <ul> |
d664547ef540
hgweb: add help link to templates missed in ead4e21f49f1
Augie Fackler <durin42@gmail.com>
parents:
12666
diff
changeset
|
230 <li><a href="/help">help</a></li> |
d664547ef540
hgweb: add help link to templates missed in ead4e21f49f1
Augie Fackler <durin42@gmail.com>
parents:
12666
diff
changeset
|
231 </ul> |
12432 | 232 </div> |
233 | |
234 <div class="main"> | |
235 <h2><a href="/">test</a></h2> | |
236 <h3>directory / @ 0:2ef0ac749a14 <span class="tag">tip</span> </h3> | |
237 | |
238 <form class="search" action="/log"> | |
239 | |
240 <p><input name="rev" id="search1" type="text" size="30" /></p> | |
241 <div id="hint">find changesets by author, revision, | |
242 files, or words in the commit message</div> | |
243 </form> | |
244 | |
245 <table class="bigtable"> | |
246 <tr> | |
247 <th class="name">name</th> | |
248 <th class="size">size</th> | |
249 <th class="permissions">permissions</th> | |
250 </tr> | |
251 <tr class="fileline parity0"> | |
252 <td class="name"><a href="/file/2ef0ac749a14/">[up]</a></td> | |
253 <td class="size"></td> | |
254 <td class="permissions">drwxr-xr-x</td> | |
255 </tr> | |
256 | |
257 <tr class="fileline parity1"> | |
258 <td class="name"> | |
259 <a href="/file/2ef0ac749a14/da"> | |
260 <img src="/static/coal-folder.png" alt="dir."/> da/ | |
261 </a> | |
262 <a href="/file/2ef0ac749a14/da/"> | |
263 | |
264 </a> | |
265 </td> | |
266 <td class="size"></td> | |
267 <td class="permissions">drwxr-xr-x</td> | |
268 </tr> | |
269 | |
270 <tr class="fileline parity0"> | |
271 <td class="filename"> | |
272 <a href="/file/2ef0ac749a14/foo"> | |
273 <img src="/static/coal-file.png" alt="file"/> foo | |
274 </a> | |
275 </td> | |
276 <td class="size">4</td> | |
277 <td class="permissions">-rw-r--r--</td> | |
278 </tr> | |
279 </table> | |
280 </div> | |
281 </div> | |
282 | |
283 | |
284 </body> | |
285 </html> | |
286 | |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
287 |
12432 | 288 stop and restart |
289 | |
290 $ "$TESTDIR/killdaemons.py" | |
291 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log | |
292 $ 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
|
293 |
12432 | 294 Test the access/error files are opened in append mode |
295 | |
296 $ python -c "print len(file('access.log').readlines()), 'log lines written'" | |
297 10 log lines written | |
298 | |
299 static file | |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
300 |
12432 | 301 $ "$TESTDIR/get-with-headers.py" --twice localhost:$HGPORT '/static/style-gitweb.css' |
302 200 Script output follows | |
303 | |
304 body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid #d9d8d1; border-width:1px; margin:10px; } | |
305 a { color:#0000cc; } | |
306 a:hover, a:visited, a:active { color:#880000; } | |
307 div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; } | |
308 div.page_header a:visited { color:#0000cc; } | |
309 div.page_header a:hover { color:#880000; } | |
310 div.page_nav { padding:8px; } | |
311 div.page_nav a:visited { color:#0000cc; } | |
312 div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px} | |
313 div.page_footer { padding:4px 8px; background-color: #d9d8d1; } | |
314 div.page_footer_text { float:left; color:#555555; font-style:italic; } | |
315 div.page_body { padding:8px; } | |
316 div.title, a.title { | |
317 display:block; padding:6px 8px; | |
318 font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000; | |
319 } | |
320 a.title:hover { background-color: #d9d8d1; } | |
321 div.title_text { padding:6px 0px; border: solid #d9d8d1; border-width:0px 0px 1px; } | |
322 div.log_body { padding:8px 8px 8px 150px; } | |
323 .age { white-space:nowrap; } | |
324 span.age { position:relative; float:left; width:142px; font-style:italic; } | |
325 div.log_link { | |
326 padding:0px 8px; | |
327 font-size:10px; font-family:sans-serif; font-style:normal; | |
328 position:relative; float:left; width:136px; | |
329 } | |
330 div.list_head { padding:6px 8px 4px; border:solid #d9d8d1; border-width:1px 0px 0px; font-style:italic; } | |
331 a.list { text-decoration:none; color:#000000; } | |
332 a.list:hover { text-decoration:underline; color:#880000; } | |
333 table { padding:8px 4px; } | |
334 th { padding:2px 5px; font-size:12px; text-align:left; } | |
335 tr.light:hover, .parity0:hover { background-color:#edece6; } | |
336 tr.dark, .parity1 { background-color:#f6f6f0; } | |
337 tr.dark:hover, .parity1:hover { background-color:#edece6; } | |
338 td { padding:2px 5px; font-size:12px; vertical-align:top; } | |
339 td.closed { background-color: #99f; } | |
340 td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; } | |
341 td.indexlinks { white-space: nowrap; } | |
342 td.indexlinks a { | |
343 padding: 2px 5px; line-height: 10px; | |
344 border: 1px solid; | |
345 color: #ffffff; background-color: #7777bb; | |
346 border-color: #aaaadd #333366 #333366 #aaaadd; | |
347 font-weight: bold; text-align: center; text-decoration: none; | |
348 font-size: 10px; | |
349 } | |
350 td.indexlinks a:hover { background-color: #6666aa; } | |
351 div.pre { font-family:monospace; font-size:12px; white-space:pre; } | |
352 div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; } | |
353 div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; } | |
354 div.search { margin:4px 8px; position:absolute; top:56px; right:12px } | |
355 .linenr { color:#999999; text-decoration:none } | |
356 div.rss_logo { float: right; white-space: nowrap; } | |
357 div.rss_logo a { | |
358 padding:3px 6px; line-height:10px; | |
359 border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e; | |
360 color:#ffffff; background-color:#ff6600; | |
361 font-weight:bold; font-family:sans-serif; font-size:10px; | |
362 text-align:center; text-decoration:none; | |
363 } | |
364 div.rss_logo a:hover { background-color:#ee5500; } | |
365 pre { margin: 0; } | |
366 span.logtags span { | |
367 padding: 0px 4px; | |
368 font-size: 10px; | |
369 font-weight: normal; | |
370 border: 1px solid; | |
371 background-color: #ffaaff; | |
372 border-color: #ffccff #ff00ee #ff00ee #ffccff; | |
373 } | |
374 span.logtags span.tagtag { | |
375 background-color: #ffffaa; | |
376 border-color: #ffffcc #ffee00 #ffee00 #ffffcc; | |
377 } | |
378 span.logtags span.branchtag { | |
379 background-color: #aaffaa; | |
380 border-color: #ccffcc #00cc33 #00cc33 #ccffcc; | |
381 } | |
382 span.logtags span.inbranchtag { | |
383 background-color: #d5dde6; | |
384 border-color: #e3ecf4 #9398f4 #9398f4 #e3ecf4; | |
385 } | |
386 | |
387 /* Graph */ | |
388 div#wrapper { | |
389 position: relative; | |
390 margin: 0; | |
391 padding: 0; | |
392 margin-top: 3px; | |
393 } | |
394 | |
395 canvas { | |
396 position: absolute; | |
397 z-index: 5; | |
398 top: -0.9em; | |
399 margin: 0; | |
400 } | |
401 | |
402 ul#nodebgs { | |
403 list-style: none inside none; | |
404 padding: 0; | |
405 margin: 0; | |
406 top: -0.7em; | |
407 } | |
408 | |
409 ul#graphnodes li, ul#nodebgs li { | |
410 height: 39px; | |
411 } | |
412 | |
413 ul#graphnodes { | |
414 position: absolute; | |
415 z-index: 10; | |
416 top: -0.8em; | |
417 list-style: none inside none; | |
418 padding: 0; | |
419 } | |
420 | |
421 ul#graphnodes li .info { | |
422 display: block; | |
423 font-size: 100%; | |
424 position: relative; | |
425 top: -3px; | |
426 font-style: italic; | |
427 } | |
428 304 Not Modified | |
429 | |
9842
d3dbdca92458
hgweb: don't choke when an inexistent style is requested (issue1901)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8167
diff
changeset
|
430 |
12432 | 431 errors |
5690
1b365c5723bc
server: append to logfiles
Mirko Friedenhagen <mirko-lists@friedenhagen.de>
parents:
5580
diff
changeset
|
432 |
12432 | 433 $ cat errors.log |