Rev 3914: Fixed as per John's review. in lp:~vila/bzr/300347-http-user-by-auth-conf
Vincent Ladeuil
v.ladeuil+lp at free.fr
Mon Dec 29 13:45:17 GMT 2008
At lp:~vila/bzr/300347-http-user-by-auth-conf
------------------------------------------------------------
revno: 3914
revision-id: v.ladeuil+lp at free.fr-20081229134515-k6vilia46la239dz
parent: aogail at w007.org-20081223231216-2wt2wokz59af10cf
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 300347-http-user-by-auth-conf
timestamp: Mon 2008-12-29 14:45:15 +0100
message:
Fixed as per John's review.
* bzrlib/transport/http/_urllib2_wrappers.py:
(AbstractAuthHandler.get_user_password): Better explain parameter
content.
* bzrlib/tests/test_http.py:
(TestAuth.get_user_url, TestAuth.get_user_transport,
TestProxyAuth.get_user_transport): Make the parameters mandatory
so that the tests carry more meaning.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_http.py'
--- a/bzrlib/tests/test_http.py 2008-12-23 23:12:16 +0000
+++ b/bzrlib/tests/test_http.py 2008-12-29 13:45:15 +0000
@@ -1447,7 +1447,7 @@
def _testing_pycurl(self):
return pycurl_present and self._transport == PyCurlTransport
- def get_user_url(self, user=None, password=None):
+ def get_user_url(self, user, password):
"""Build an url embedding user and password"""
url = '%s://' % self.server._url_protocol
if user is not None:
@@ -1458,12 +1458,12 @@
url += '%s:%s/' % (self.server.host, self.server.port)
return url
- def get_user_transport(self, user=None, password=None):
+ def get_user_transport(self, user, password):
return self._transport(self.get_user_url(user, password))
def test_no_user(self):
self.server.add_user('joe', 'foo')
- t = self.get_user_transport()
+ t = self.get_user_transport(None, None)
self.assertRaises(errors.InvalidHttpResponse, t.get, 'a')
# Only one 'Authentication Required' error should occur
self.assertEqual(1, self.server.auth_required_errors)
@@ -1570,7 +1570,7 @@
{'httptest': {'scheme': 'http', 'port': self.server.port,
'user': user, 'password': password}})
conf._save()
- t = self.get_user_transport()
+ t = self.get_user_transport(None, None)
# Issue a request to the server to connect
self.assertEqual('contents of a\n', t.get('a').read())
# Only one 'Authentication Required' error should occur
@@ -1627,7 +1627,7 @@
protocol_version=self._protocol_version)
return server
- def get_user_transport(self, user=None, password=None):
+ def get_user_transport(self, user, password):
self._install_env({'all_proxy': self.get_user_url(user, password)})
return self._transport(self.server.get_url())
=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- a/bzrlib/transport/http/_urllib2_wrappers.py 2008-12-23 23:12:16 +0000
+++ b/bzrlib/transport/http/_urllib2_wrappers.py 2008-12-29 13:45:15 +0000
@@ -1041,7 +1041,8 @@
def get_user_password(self, auth):
"""Ask user for a password if none is already available.
- :param auth: authentication headers from the HTTP response
+ :param auth: authentication info gathered so far (from the initial url
+ and then during dialog with the server).
"""
auth_conf = config.AuthenticationConfig()
user = auth['user']
More information about the bazaar-commits
mailing list