Rev 6560: (vila) Remove obsolete (and not used anymore) code and its associated tests in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Mon Sep 17 09:38:31 UTC 2012


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6560 [merge]
revision-id: pqm at pqm.ubuntu.com-20120917093830-1o8asgkr9jd62yyd
parent: pqm at pqm.ubuntu.com-20120914172235-tvv720qmlchw8270
parent: v.ladeuil+lp at free.fr-20120917065815-aklenqt1f85hp17b
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2012-09-17 09:38:30 +0000
message:
  (vila) Remove obsolete (and not used anymore) code and its associated tests
   (covered by other tests in test_http.py). (Vincent Ladeuil)
modified:
  bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
  bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
=== modified file 'bzrlib/tests/test_http.py'
--- a/bzrlib/tests/test_http.py	2012-08-04 14:27:47 +0000
+++ b/bzrlib/tests/test_http.py	2012-09-17 06:58:15 +0000
@@ -384,24 +384,6 @@
     _transport = property(_get_pycurl_maybe)
 
 
-class TestHttpUrls(tests.TestCase):
-
-    # TODO: This should be moved to authorization tests once they
-    # are written.
-
-    def test_url_parsing(self):
-        f = FakeManager()
-        url = http.extract_auth('http://example.com', f)
-        self.assertEqual('http://example.com', url)
-        self.assertEqual(0, len(f.credentials))
-        url = http.extract_auth(
-            'http://user:pass@example.com/bzr/bzr.dev', f)
-        self.assertEqual('http://example.com/bzr/bzr.dev', url)
-        self.assertEqual(1, len(f.credentials))
-        self.assertEqual([None, 'example.com', 'user', 'pass'],
-                         f.credentials[0])
-
-
 class TestHttpTransportUrls(tests.TestCase):
     """Test the http urls."""
 

=== modified file 'bzrlib/transport/http/__init__.py'
--- a/bzrlib/transport/http/__init__.py	2012-02-14 14:55:25 +0000
+++ b/bzrlib/transport/http/__init__.py	2012-09-17 06:58:15 +0000
@@ -40,41 +40,6 @@
     ConnectedTransport,
     )
 
-# TODO: This is not used anymore by HttpTransport_urllib
-# (extracting the auth info and prompting the user for a password
-# have been split), only the tests still use it. It should be
-# deleted and the tests rewritten ASAP to stay in sync.
-def extract_auth(url, password_manager):
-    """Extract auth parameters from am HTTP/HTTPS url and add them to the given
-    password manager.  Return the url, minus those auth parameters (which
-    confuse urllib2).
-    """
-    if not re.match(r'^(https?)(\+\w+)?://', url):
-        raise ValueError(
-            'invalid absolute url %r' % (url,))
-    scheme, netloc, path, query, fragment = urlparse.urlsplit(url)
-
-    if '@' in netloc:
-        auth, netloc = netloc.split('@', 1)
-        if ':' in auth:
-            username, password = auth.split(':', 1)
-        else:
-            username, password = auth, None
-        if ':' in netloc:
-            host = netloc.split(':', 1)[0]
-        else:
-            host = netloc
-        username = urlutils.unquote(username)
-        if password is not None:
-            password = urlutils.unquote(password)
-        else:
-            password = ui.ui_factory.get_password(
-                prompt=u'HTTP %(user)s@%(host)s password',
-                user=username, host=host)
-        password_manager.add_password(None, host, username, password)
-    url = urlparse.urlunsplit((scheme, netloc, path, query, fragment))
-    return url
-
 
 class HttpTransportBase(ConnectedTransport):
     """Base class for http implementations.




More information about the bazaar-commits mailing list