Mercurial > hg
comparison tests/test-http.t @ 41589:46432c04f010
tests: enable HTTP digest testing
I suppose we could spin the client side extension off to a *.py file if it gets
more use. I was basically just looking to avoid killing the server and
relaunching it just to change authentication schemes, because that doesn't
always work on Windows.
The test changes capture the problem with py3.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 05 Feb 2019 16:47:19 -0500 |
parents | 549af2fa089f |
children | 349c8879becd |
comparison
equal
deleted
inserted
replaced
41588:765a608c2108 | 41589:46432c04f010 |
---|---|
171 + use the same server to test server side streaming preference | 171 + use the same server to test server side streaming preference |
172 | 172 |
173 $ cd test | 173 $ cd test |
174 | 174 |
175 $ hg serve --config extensions.x=$TESTDIR/httpserverauth.py -p $HGPORT2 -d \ | 175 $ hg serve --config extensions.x=$TESTDIR/httpserverauth.py -p $HGPORT2 -d \ |
176 > --pid-file=pid --config server.preferuncompressed=True \ | 176 > --pid-file=pid --config server.preferuncompressed=True -E ../errors2.log \ |
177 > --config web.push_ssl=False --config web.allow_push=* -A ../access.log | 177 > --config web.push_ssl=False --config web.allow_push=* -A ../access.log |
178 $ cat pid >> $DAEMON_PIDS | 178 $ cat pid >> $DAEMON_PIDS |
179 | 179 |
180 $ cat << EOF > get_pass.py | 180 $ cat << EOF > get_pass.py |
181 > import getpass | 181 > import getpass |
207 $ hg id http://localhost:$HGPORT2/ | 207 $ hg id http://localhost:$HGPORT2/ |
208 5fed3813f7f5 | 208 5fed3813f7f5 |
209 $ hg id http://user@localhost:$HGPORT2/ | 209 $ hg id http://user@localhost:$HGPORT2/ |
210 5fed3813f7f5 | 210 5fed3813f7f5 |
211 | 211 |
212 $ cat > use_digests.py << EOF | |
213 > from mercurial import ( | |
214 > exthelper, | |
215 > url, | |
216 > ) | |
217 > | |
218 > eh = exthelper.exthelper() | |
219 > uisetup = eh.finaluisetup | |
220 > | |
221 > @eh.wrapfunction(url, 'opener') | |
222 > def urlopener(orig, *args, **kwargs): | |
223 > opener = orig(*args, **kwargs) | |
224 > opener.addheaders.append((r'X-HgTest-AuthType', r'Digest')) | |
225 > return opener | |
226 > EOF | |
227 | |
228 $ hg id http://localhost:$HGPORT2/ --config extensions.x=use_digests.py || true | |
229 abort: HTTP Error 403: bad user (py3 !) | |
230 5fed3813f7f5 (no-py3 !) | |
231 | |
212 #if no-reposimplestore | 232 #if no-reposimplestore |
213 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1 | 233 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1 |
214 streaming all changes | 234 streaming all changes |
215 10 files to transfer, 1.01 KB of data | 235 10 files to transfer, 1.01 KB of data |
216 transferred * KB in * seconds (*/sec) (glob) | 236 transferred * KB in * seconds (*/sec) (glob) |
360 "GET /?cmd=capabilities HTTP/1.1" 401 - | 380 "GET /?cmd=capabilities HTTP/1.1" 401 - |
361 "GET /?cmd=capabilities HTTP/1.1" 200 - | 381 "GET /?cmd=capabilities HTTP/1.1" 200 - |
362 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | 382 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
363 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | 383 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
364 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | 384 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
385 "GET /?cmd=capabilities HTTP/1.1" 401 - x-hgtest-authtype:Digest | |
386 "GET /?cmd=capabilities HTTP/1.1" 403 - x-hgtest-authtype:Digest (py3 !) | |
387 "GET /?cmd=capabilities HTTP/1.1" 200 - x-hgtest-authtype:Digest (no-py3 !) | |
388 "GET /?cmd=lookup HTTP/1.1" 401 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (no-py3 !) | |
389 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (no-py3 !) | |
390 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (no-py3 !) | |
391 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (no-py3 !) | |
392 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (no-py3 !) | |
393 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (no-py3 !) | |
365 "GET /?cmd=capabilities HTTP/1.1" 401 - (no-reposimplestore !) | 394 "GET /?cmd=capabilities HTTP/1.1" 401 - (no-reposimplestore !) |
366 "GET /?cmd=capabilities HTTP/1.1" 200 - (no-reposimplestore !) | 395 "GET /?cmd=capabilities HTTP/1.1" 200 - (no-reposimplestore !) |
367 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !) | 396 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !) |
368 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&stream=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !) | 397 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&stream=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !) |
369 "GET /?cmd=capabilities HTTP/1.1" 401 - (no-reposimplestore !) | 398 "GET /?cmd=capabilities HTTP/1.1" 401 - (no-reposimplestore !) |
428 [255] | 457 [255] |
429 | 458 |
430 check error log | 459 check error log |
431 | 460 |
432 $ cat error.log | 461 $ cat error.log |
462 | |
463 $ cat errors2.log | |
464 $LOCALIP - - [$ERRDATE$] HG error: No hash found for user/realm "b'user'/mercurial" (glob) (py3 !) | |
433 | 465 |
434 check abort error reporting while pulling/cloning | 466 check abort error reporting while pulling/cloning |
435 | 467 |
436 $ $RUNTESTDIR/killdaemons.py | 468 $ $RUNTESTDIR/killdaemons.py |
437 $ hg serve -R test -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py | 469 $ hg serve -R test -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py |