diff 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
line wrap: on
line diff
--- a/tests/test-hgweb-auth.py	Fri Aug 05 21:05:40 2011 +0200
+++ b/tests/test-hgweb-auth.py	Fri Aug 05 21:05:41 2011 +0200
@@ -37,10 +37,10 @@
         print 'URI:', uri
         try:
             pm = url.passwordmgr(ui)
-            authinfo = util.url(uri).authinfo()[1]
+            u, authinfo = util.url(uri).authinfo()
             if authinfo is not None:
                 pm.add_password(*authinfo)
-            print '    ', pm.find_user_password('test', uri)
+            print '    ', pm.find_user_password('test', u)
         except Abort, e:
             print 'abort'