comparison tests/test-hgweb-auth.py @ 15025:0593e8f81c71 stable

http: pass user to readauthforuri() (fix 4a43e23b8c55) urllib2 never handles URIs with credentials, we have to extract them and store them in the password manager before handing the stripped URI. Half of the changes deducing the username from the URI in 4a43e23b8c55 were incorrect. Instead, we retrieve the username from the password manager before passing to readauthforuri(). test-hgweb-auth.py was passing because the test itself was flawed: it was passing URIs with credentials to find_password(), which never happens.
author Patrick Mezard <pmezard@gmail.com>
date Fri, 05 Aug 2011 21:05:41 +0200
parents 0f1311e829c9
children 9de689d20230
comparison
equal deleted inserted replaced
15024:0f1311e829c9 15025:0593e8f81c71
35 35
36 def _test(uri): 36 def _test(uri):
37 print 'URI:', uri 37 print 'URI:', uri
38 try: 38 try:
39 pm = url.passwordmgr(ui) 39 pm = url.passwordmgr(ui)
40 authinfo = util.url(uri).authinfo()[1] 40 u, authinfo = util.url(uri).authinfo()
41 if authinfo is not None: 41 if authinfo is not None:
42 pm.add_password(*authinfo) 42 pm.add_password(*authinfo)
43 print ' ', pm.find_user_password('test', uri) 43 print ' ', pm.find_user_password('test', u)
44 except Abort, e: 44 except Abort, e:
45 print 'abort' 45 print 'abort'
46 46
47 if not urls: 47 if not urls:
48 urls = [ 48 urls = [