##// END OF EJS Templates
tests: additional test coverage of archive web command...
Gregory Szorc -
r36890:40193f97 default
parent child Browse files
Show More
@@ -106,10 +106,13 hg subrepos are shared into existence on
106 > --config extensions.blackbox= --config blackbox.track=develwarn
106 > --config extensions.blackbox= --config blackbox.track=develwarn
107 > cat hg.pid >> $DAEMON_PIDS
107 > cat hg.pid >> $DAEMON_PIDS
108 > echo % $1 allowed should give 200
108 > echo % $1 allowed should give 200
109 > get-with-headers.py localhost:$HGPORT "archive/tip.$2" | head -n 1
109 > get-with-headers.py --bodyfile body localhost:$HGPORT "archive/tip.$2" -
110 > f --size --sha1 body
110 > echo % $3 and $4 disallowed should both give 403
111 > echo % $3 and $4 disallowed should both give 403
111 > get-with-headers.py localhost:$HGPORT "archive/tip.$3" | head -n 1
112 > get-with-headers.py --bodyfile body localhost:$HGPORT "archive/tip.$3" -
112 > get-with-headers.py localhost:$HGPORT "archive/tip.$4" | head -n 1
113 > f --size --sha1 body
114 > get-with-headers.py --bodyfile body localhost:$HGPORT "archive/tip.$4" -
115 > f --size --sha1 body
113 > killdaemons.py
116 > killdaemons.py
114 > cat errors.log
117 > cat errors.log
115 > hg blackbox --config extensions.blackbox= --config blackbox.track=
118 > hg blackbox --config extensions.blackbox= --config blackbox.track=
@@ -121,42 +124,174 check http return codes
121 $ test_archtype gz tar.gz tar.bz2 zip
124 $ test_archtype gz tar.gz tar.bz2 zip
122 % gz allowed should give 200
125 % gz allowed should give 200
123 200 Script output follows
126 200 Script output follows
127 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.gz
128 content-type: application/x-gzip
129 date: * (glob)
130 etag: W/"*" (glob)
131 server: * (glob)
132 transfer-encoding: chunked
133
134 body: size=408, sha1=8fa06531bddecc365a9f5edb0f88b65974bfe505
124 % tar.bz2 and zip disallowed should both give 403
135 % tar.bz2 and zip disallowed should both give 403
125 403 Archive type not allowed: bz2
136 403 Archive type not allowed: bz2
137 content-type: text/html; charset=ascii
138 date: * (glob)
139 etag: W/"*" (glob)
140 server: * (glob)
141 transfer-encoding: chunked
142
143 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
126 403 Archive type not allowed: zip
144 403 Archive type not allowed: zip
145 content-type: text/html; charset=ascii
146 date: * (glob)
147 etag: W/"*" (glob)
148 server: * (glob)
149 transfer-encoding: chunked
150
151 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
127 $ test_archtype bz2 tar.bz2 zip tar.gz
152 $ test_archtype bz2 tar.bz2 zip tar.gz
128 % bz2 allowed should give 200
153 % bz2 allowed should give 200
129 200 Script output follows
154 200 Script output follows
155 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.bz2
156 content-type: application/x-bzip2
157 date: * (glob)
158 etag: W/"*" (glob)
159 server: * (glob)
160 transfer-encoding: chunked
161
162 body: size=426, sha1=8d87f5aba6e14f1bfea6c232985982c278b2fb0b
130 % zip and tar.gz disallowed should both give 403
163 % zip and tar.gz disallowed should both give 403
131 403 Archive type not allowed: zip
164 403 Archive type not allowed: zip
165 content-type: text/html; charset=ascii
166 date: * (glob)
167 etag: W/"*" (glob)
168 server: * (glob)
169 transfer-encoding: chunked
170
171 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
132 403 Archive type not allowed: gz
172 403 Archive type not allowed: gz
173 content-type: text/html; charset=ascii
174 date: * (glob)
175 etag: W/"*" (glob)
176 server: * (glob)
177 transfer-encoding: chunked
178
179 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
133 $ test_archtype zip zip tar.gz tar.bz2
180 $ test_archtype zip zip tar.gz tar.bz2
134 % zip allowed should give 200
181 % zip allowed should give 200
135 200 Script output follows
182 200 Script output follows
183 content-disposition: attachment; filename=test-archive-1701ef1f1510.zip
184 content-type: application/zip
185 date: * (glob)
186 etag: W/"*" (glob)
187 server: * (glob)
188 transfer-encoding: chunked
189
190 body: size=1377, sha1=677b14d3d048778d5eb5552c14a67e6192068650
136 % tar.gz and tar.bz2 disallowed should both give 403
191 % tar.gz and tar.bz2 disallowed should both give 403
137 403 Archive type not allowed: gz
192 403 Archive type not allowed: gz
193 content-type: text/html; charset=ascii
194 date: * (glob)
195 etag: W/"*" (glob)
196 server: * (glob)
197 transfer-encoding: chunked
198
199 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
138 403 Archive type not allowed: bz2
200 403 Archive type not allowed: bz2
201 content-type: text/html; charset=ascii
202 date: * (glob)
203 etag: W/"*" (glob)
204 server: * (glob)
205 transfer-encoding: chunked
206
207 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
139
208
140 check http return codes (with deprecated option)
209 check http return codes (with deprecated option)
141
210
142 $ test_archtype_deprecated gz tar.gz tar.bz2 zip
211 $ test_archtype_deprecated gz tar.gz tar.bz2 zip
143 % gz allowed should give 200
212 % gz allowed should give 200
144 200 Script output follows
213 200 Script output follows
214 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.gz
215 content-type: application/x-gzip
216 date: * (glob)
217 etag: W/"*" (glob)
218 server: * (glob)
219 transfer-encoding: chunked
220
221 body: size=408, sha1=8fa06531bddecc365a9f5edb0f88b65974bfe505
145 % tar.bz2 and zip disallowed should both give 403
222 % tar.bz2 and zip disallowed should both give 403
146 403 Archive type not allowed: bz2
223 403 Archive type not allowed: bz2
224 content-type: text/html; charset=ascii
225 date: * (glob)
226 etag: W/"*" (glob)
227 server: * (glob)
228 transfer-encoding: chunked
229
230 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
147 403 Archive type not allowed: zip
231 403 Archive type not allowed: zip
232 content-type: text/html; charset=ascii
233 date: * (glob)
234 etag: W/"*" (glob)
235 server: * (glob)
236 transfer-encoding: chunked
237
238 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
148 $ test_archtype_deprecated bz2 tar.bz2 zip tar.gz
239 $ test_archtype_deprecated bz2 tar.bz2 zip tar.gz
149 % bz2 allowed should give 200
240 % bz2 allowed should give 200
150 200 Script output follows
241 200 Script output follows
242 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.bz2
243 content-type: application/x-bzip2
244 date: * (glob)
245 etag: W/"*" (glob)
246 server: * (glob)
247 transfer-encoding: chunked
248
249 body: size=426, sha1=8d87f5aba6e14f1bfea6c232985982c278b2fb0b
151 % zip and tar.gz disallowed should both give 403
250 % zip and tar.gz disallowed should both give 403
152 403 Archive type not allowed: zip
251 403 Archive type not allowed: zip
252 content-type: text/html; charset=ascii
253 date: * (glob)
254 etag: W/"*" (glob)
255 server: * (glob)
256 transfer-encoding: chunked
257
258 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
153 403 Archive type not allowed: gz
259 403 Archive type not allowed: gz
260 content-type: text/html; charset=ascii
261 date: * (glob)
262 etag: W/"*" (glob)
263 server: * (glob)
264 transfer-encoding: chunked
265
266 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
154 $ test_archtype_deprecated zip zip tar.gz tar.bz2
267 $ test_archtype_deprecated zip zip tar.gz tar.bz2
155 % zip allowed should give 200
268 % zip allowed should give 200
156 200 Script output follows
269 200 Script output follows
270 content-disposition: attachment; filename=test-archive-1701ef1f1510.zip
271 content-type: application/zip
272 date: * (glob)
273 etag: W/"*" (glob)
274 server: * (glob)
275 transfer-encoding: chunked
276
277 body: size=1377, sha1=677b14d3d048778d5eb5552c14a67e6192068650
157 % tar.gz and tar.bz2 disallowed should both give 403
278 % tar.gz and tar.bz2 disallowed should both give 403
158 403 Archive type not allowed: gz
279 403 Archive type not allowed: gz
280 content-type: text/html; charset=ascii
281 date: * (glob)
282 etag: W/"*" (glob)
283 server: * (glob)
284 transfer-encoding: chunked
285
286 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
159 403 Archive type not allowed: bz2
287 403 Archive type not allowed: bz2
288 content-type: text/html; charset=ascii
289 date: * (glob)
290 etag: W/"*" (glob)
291 server: * (glob)
292 transfer-encoding: chunked
293
294 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
160
295
161 $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
296 $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
162 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
297 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
General Comments 0
You need to be logged in to leave comments. Login now