Mercurial > hg
comparison tests/test-hgweb-auth.py @ 29377:2c019aac6b99
url: extract password database from password manager
So far password manager was keeping authentication information so opening
new connection and creating new password manager made all saved authentication
information lost.
This commit separates password manager and password database to make it
possible to reuse saved authentication information.
This commit violates code checker because it adds add_password method (name
with underscore) to passwordmgr object to provide method required by urllib2.
author | liscju <piotr.listkiewicz@gmail.com> |
---|---|
date | Sun, 05 Jun 2016 23:36:23 +0200 |
parents | 032c4c2f802a |
children | d83ca854fa21 |
comparison
equal
deleted
inserted
replaced
29376:113d0b23321a | 29377:2c019aac6b99 |
---|---|
41 ui = writeauth(auth) | 41 ui = writeauth(auth) |
42 | 42 |
43 def _test(uri): | 43 def _test(uri): |
44 print('URI:', uri) | 44 print('URI:', uri) |
45 try: | 45 try: |
46 pm = url.passwordmgr(ui) | 46 pm = url.passwordmgr(ui, urlreq.httppasswordmgrwithdefaultrealm()) |
47 u, authinfo = util.url(uri).authinfo() | 47 u, authinfo = util.url(uri).authinfo() |
48 if authinfo is not None: | 48 if authinfo is not None: |
49 pm.add_password(*authinfo) | 49 pm.add_password(*authinfo) |
50 print(' ', pm.find_user_password('test', u)) | 50 print(' ', pm.find_user_password('test', u)) |
51 except error.Abort: | 51 except error.Abort: |