Mercurial > hg-stable
diff tests/test-lfs-serve-access.t @ 41598:549af2fa089f
tests: extract the http server authentication extension to a single module
We had 4 copy/pastes of this, and no coverage for http digests (which are
currently broken on py3).
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 05 Feb 2019 09:37:23 -0500 |
parents | 080a5c83914f |
children | 698667eb7523 |
line wrap: on
line diff
--- a/tests/test-lfs-serve-access.t Sat Feb 02 21:58:49 2019 -0800 +++ b/tests/test-lfs-serve-access.t Tue Feb 05 09:37:23 2019 -0500 @@ -393,22 +393,7 @@ > l.password=pass > EOF - $ cat << EOF > userpass.py - > import base64 - > from mercurial.hgweb import common - > def perform_authentication(hgweb, req, op): - > auth = req.headers.get(b'Authorization') - > if not auth: - > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, b'who', - > [(b'WWW-Authenticate', b'Basic Realm="mercurial"')]) - > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', - > b'pass']: - > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no') - > def extsetup(ui): - > common.permhooks.insert(0, perform_authentication) - > EOF - - $ hg --config extensions.x=$TESTTMP/userpass.py \ + $ hg --config extensions.x=$TESTDIR/httpserverauth.py \ > -R server serve -d -p $HGPORT1 --pid-file=hg.pid \ > -A $TESTTMP/access.log -E $TESTTMP/errors.log $ mv hg.pid $DAEMON_PIDS