tests/test-hgweb-auth.py
branchstable
changeset 15024 0f1311e829c9
parent 15005 4a43e23b8c55
child 15025 0593e8f81c71
--- a/tests/test-hgweb-auth.py	Thu Aug 04 19:41:23 2011 +0300
+++ b/tests/test-hgweb-auth.py	Fri Aug 05 21:05:40 2011 +0200
@@ -1,4 +1,5 @@
 from mercurial import demandimport; demandimport.enable()
+import urllib2
 from mercurial import ui, util
 from mercurial import url
 from mercurial.error import Abort
@@ -95,3 +96,12 @@
       'y.username': 'y',
       'y.password': 'ypassword'},
      urls=['http://y@example.org/foo/bar'])
+
+def testauthinfo(fullurl, authurl):
+    print 'URIs:', fullurl, authurl
+    pm = urllib2.HTTPPasswordMgrWithDefaultRealm()
+    pm.add_password(*util.url(fullurl).authinfo()[1])
+    print pm.find_user_password('test', authurl)
+
+print '\n*** Test urllib2 and util.url\n'
+testauthinfo('http://user@example.com:8080/foo', 'http://example.com:8080/foo')