Merge lp:~vila/bzr/extract-auth-obsolete into lp:bzr

Proposed by Vincent Ladeuil on 2012-09-17
Status: Merged
Approved by: Martin Packman on 2012-09-17
Approved revision: 6560
Merged at revision: 6560
Proposed branch: lp:~vila/bzr/extract-auth-obsolete
Merge into: lp:bzr
Diff against target: 74 lines (+0/-53)
2 files modified
bzrlib/tests/test_http.py (+0/-18)
bzrlib/transport/http/__init__.py (+0/-35)
To merge this branch: bzr merge lp:~vila/bzr/extract-auth-obsolete
Reviewer Review Type Date Requested Status
Martin Packman (community) 2012-09-17 Approve on 2012-09-17
Review via email: mp+124608@code.launchpad.net

Commit message

Remove obsolete (and not used anymore) code and its associated tests (covered by other tests in test_http.py).

Description of the change

Remove obsolete (and not used anymore) code and its associated tests
(covered by other tests in test_http.py).

To post a comment you must log in.
Martin Packman (gz) wrote :

Looks reasonable.

review: Approve
Vincent Ladeuil (vila) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/tests/test_http.py'
2--- bzrlib/tests/test_http.py 2012-08-04 14:27:47 +0000
3+++ bzrlib/tests/test_http.py 2012-09-17 07:08:20 +0000
4@@ -384,24 +384,6 @@
5 _transport = property(_get_pycurl_maybe)
6
7
8-class TestHttpUrls(tests.TestCase):
9-
10- # TODO: This should be moved to authorization tests once they
11- # are written.
12-
13- def test_url_parsing(self):
14- f = FakeManager()
15- url = http.extract_auth('http://example.com', f)
16- self.assertEqual('http://example.com', url)
17- self.assertEqual(0, len(f.credentials))
18- url = http.extract_auth(
19- 'http://user:pass@example.com/bzr/bzr.dev', f)
20- self.assertEqual('http://example.com/bzr/bzr.dev', url)
21- self.assertEqual(1, len(f.credentials))
22- self.assertEqual([None, 'example.com', 'user', 'pass'],
23- f.credentials[0])
24-
25-
26 class TestHttpTransportUrls(tests.TestCase):
27 """Test the http urls."""
28
29
30=== modified file 'bzrlib/transport/http/__init__.py'
31--- bzrlib/transport/http/__init__.py 2012-02-14 14:55:25 +0000
32+++ bzrlib/transport/http/__init__.py 2012-09-17 07:08:20 +0000
33@@ -40,41 +40,6 @@
34 ConnectedTransport,
35 )
36
37-# TODO: This is not used anymore by HttpTransport_urllib
38-# (extracting the auth info and prompting the user for a password
39-# have been split), only the tests still use it. It should be
40-# deleted and the tests rewritten ASAP to stay in sync.
41-def extract_auth(url, password_manager):
42- """Extract auth parameters from am HTTP/HTTPS url and add them to the given
43- password manager. Return the url, minus those auth parameters (which
44- confuse urllib2).
45- """
46- if not re.match(r'^(https?)(\+\w+)?://', url):
47- raise ValueError(
48- 'invalid absolute url %r' % (url,))
49- scheme, netloc, path, query, fragment = urlparse.urlsplit(url)
50-
51- if '@' in netloc:
52- auth, netloc = netloc.split('@', 1)
53- if ':' in auth:
54- username, password = auth.split(':', 1)
55- else:
56- username, password = auth, None
57- if ':' in netloc:
58- host = netloc.split(':', 1)[0]
59- else:
60- host = netloc
61- username = urlutils.unquote(username)
62- if password is not None:
63- password = urlutils.unquote(password)
64- else:
65- password = ui.ui_factory.get_password(
66- prompt=u'HTTP %(user)s@%(host)s password',
67- user=username, host=host)
68- password_manager.add_password(None, host, username, password)
69- url = urlparse.urlunsplit((scheme, netloc, path, query, fragment))
70- return url
71-
72
73 class HttpTransportBase(ConnectedTransport):
74 """Base class for http implementations.