~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Vincent Ladeuil
  • Date: 2007-10-22 21:19:13 UTC
  • mto: (2961.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 2962.
  • Revision ID: v.ladeuil+lp@free.fr-20071022211913-119445k3qco40sx0
Make hhtp proxy aware of AuthenticationConfig (for password).

* bzrlib/transport/http/_urllib2_wrappers.py:
(Request.__init__): Update the auth dict content documentation.
(extract_credentials, extract_authentication_uri): Deleted.
(PasswordManager): Deleted.
(ProxyHandler.set_proxy): Query AuthenticationConfig for the
password. Simplified.
(AbstractAuthHandler): Looong forgotten feedback review about
_retry_count. The behaviour is not changed.
(AbstractAuthHandler.get_password): Change signature now that the
auth dict contains all relevant information. Simplified.
(DigestAuthHandler.auth_match): Delete gratuitous differences with
BasicAuthHandler.
(Opener.__init__): Get rid of PasswordManager.

* bzrlib/transport/http/_urllib.py:
(HttpTransport_urllib._perform): Replace authuri by its components
in the auth dict.

* bzrlib/transport/ftp.py: 
Register 'aftp' for urlparse (revealed by the host empty test in
_split_url).

* bzrlib/transport/__init__.py:
(ConnectedTransport._split_url): Check that host is not empty. Was
first needed to make a proxy test pass, but revealed more bugs in
the test suite.

* bzrlib/tests/test_transport_implementations.py:
(TransportTests.test__reuse_for): Fix bug revealed by the host
empty test in _split_url.

* bzrlib/tests/test_transport.py:
(TestConnectedTransport.test_connection_sharing_propagate_credentials): 
Fix bug revealed by the host empty test in _split_url.

* bzrlib/tests/test_smart_transport.py:
(HTTPTunnellingSmokeTest._test_bulk_data): Fix bug revealed by the
host empty test in _split_url.

* bzrlib/tests/test_http.py:
(TestHttpTransportUrls.test_invalid_http_urls): ConnectionError
can't be raised here.
(TestHttpProxyWhiteBox._proxied_request): No more PasswordManager,
yeah !
(TestProxyHttpServer): Delete FIXME, tests have been added a long
time ago.

* bzrlib/config.py:
(AuthenticationConfig.get_user): Fix silly copy/paste.
(AuthenticationConfig.get_password): Fix oversight.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
    )
80
80
from bzrlib.transport.http._urllib import HttpTransport_urllib
81
81
from bzrlib.transport.http._urllib2_wrappers import (
82
 
    PasswordManager,
83
82
    ProxyHandler,
84
83
    Request,
85
84
    )
205
204
    def test_invalid_http_urls(self):
206
205
        """Trap invalid construction of urls"""
207
206
        t = self._transport('http://bazaar-vcs.org/bzr/bzr.dev/')
208
 
        self.assertRaises((errors.InvalidURL, errors.ConnectionError),
 
207
        self.assertRaises(errors.InvalidURL,
209
208
                          self._transport,
210
209
                          'http://http://bazaar-vcs.org/bzr/bzr.dev/')
211
210
 
798
797
            osutils.set_or_unset_env(name, value)
799
798
 
800
799
    def _proxied_request(self):
801
 
        handler = ProxyHandler(PasswordManager())
 
800
        handler = ProxyHandler()
802
801
        request = Request('GET','http://baz/buzzle')
803
802
        handler.set_proxy(request, 'http')
804
803
        return request
833
832
    # FIXME: We don't have an https server available, so we don't
834
833
    # test https connections.
835
834
 
836
 
    # FIXME: Once the test suite is better fitted to test
837
 
    # authorization schemes, test proxy authorizations too (see
838
 
    # bug #83954).
839
 
 
840
835
    def setUp(self):
841
836
        TestCaseWithTwoWebservers.setUp(self)
842
837
        self.build_tree_contents([('foo', 'contents of foo\n'),