Merge lp:~jelmer/brz/remove-register-branch into lp:brz
- remove-register-branch
- Merge into trunk
Proposed by
Jelmer Vernooij
Status: | Merged |
---|---|
Approved by: | The Breezy Bot |
Approved revision: | no longer in the source branch. |
Merge reported by: | The Breezy Bot |
Merged at revision: | not available |
Proposed branch: | lp:~jelmer/brz/remove-register-branch |
Merge into: | lp:brz |
Diff against target: |
642 lines (+34/-431) 5 files modified
breezy/plugins/launchpad/__init__.py (+1/-8) breezy/plugins/launchpad/cmds.py (+1/-110) breezy/plugins/launchpad/lp_registration.py (+11/-116) breezy/plugins/launchpad/test_register.py (+12/-197) doc/en/release-notes/brz-3.0.txt (+9/-0) |
To merge this branch: | bzr merge lp:~jelmer/brz/remove-register-branch |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Packman | Approve | ||
Review via email: mp+324987@code.launchpad.net |
Commit message
Remove unusable register-branch command.
Description of the change
Remove long unusable register-branch command.
From https:/
To post a comment you must log in.
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
http://
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
http://
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'breezy/plugins/launchpad/__init__.py' |
2 | --- breezy/plugins/launchpad/__init__.py 2017-05-23 14:08:03 +0000 |
3 | +++ breezy/plugins/launchpad/__init__.py 2017-06-02 02:04:52 +0000 |
4 | @@ -1,4 +1,4 @@ |
5 | -# Copyright (C) 2006-2011 Canonical Ltd |
6 | +# Copyright (C) 2006-2017 Canonical Ltd |
7 | # |
8 | # This program is free software; you can redistribute it and/or modify |
9 | # it under the terms of the GNU General Public License as published by |
10 | @@ -30,7 +30,6 @@ |
11 | launchpad-login: Show or set the Launchpad user ID |
12 | launchpad-open: Open a Launchpad branch page in your web browser |
13 | lp-propose-merge: Propose merging a branch on Launchpad |
14 | - register-branch: Register a branch with launchpad.net |
15 | launchpad-mirror: Ask Launchpad to mirror a branch now |
16 | |
17 | """ |
18 | @@ -57,7 +56,6 @@ |
19 | from ...help_topics import topic_registry |
20 | |
21 | for klsname, aliases in [ |
22 | - ("cmd_register_branch", []), |
23 | ("cmd_launchpad_open", ["lp-open"]), |
24 | ("cmd_launchpad_login", ["lp-login"]), |
25 | ("cmd_launchpad_mirror", ["lp-mirror"]), |
26 | @@ -177,11 +175,6 @@ |
27 | Launchpad bug 12345. When you push that branch to Launchpad it will |
28 | automatically be linked to the bug report. |
29 | |
30 | - * The register-branch command tells Launchpad about the url of a |
31 | - public branch. Launchpad will then mirror the branch, display |
32 | - its contents and allow it to be attached to bugs and other |
33 | - objects. |
34 | - |
35 | For more information see http://help.launchpad.net/ |
36 | """ |
37 | topic_registry.register('launchpad', |
38 | |
39 | === modified file 'breezy/plugins/launchpad/cmds.py' |
40 | --- breezy/plugins/launchpad/cmds.py 2017-05-22 00:56:52 +0000 |
41 | +++ breezy/plugins/launchpad/cmds.py 2017-06-02 02:04:52 +0000 |
42 | @@ -1,4 +1,4 @@ |
43 | -# Copyright (C) 2006-2012 Canonical Ltd |
44 | +# Copyright (C) 2006-2017 Canonical Ltd |
45 | # |
46 | # This program is free software; you can redistribute it and/or modify |
47 | # it under the terms of the GNU General Public License as published by |
48 | @@ -29,7 +29,6 @@ |
49 | from ...errors import ( |
50 | BzrCommandError, |
51 | InvalidURL, |
52 | - NoPublicBranch, |
53 | NotBranchError, |
54 | ) |
55 | from ...i18n import gettext |
56 | @@ -39,114 +38,6 @@ |
57 | ) |
58 | |
59 | |
60 | -class cmd_register_branch(Command): |
61 | - __doc__ = """Register a branch with launchpad.net. |
62 | - |
63 | - This command lists a brz branch in the directory of branches on |
64 | - launchpad.net. Registration allows the branch to be associated with |
65 | - bugs or specifications. |
66 | - |
67 | - Before using this command you must register the project to which the |
68 | - branch belongs, and create an account for yourself on launchpad.net. |
69 | - |
70 | - arguments: |
71 | - public_url: The publicly visible url for the branch to register. |
72 | - This must be an http or https url (which Launchpad can read |
73 | - from to access the branch). Local file urls, SFTP urls, and |
74 | - brz+ssh urls will not work. |
75 | - If no public_url is provided, brz will use the configured |
76 | - public_url if there is one for the current branch, and |
77 | - otherwise error. |
78 | - |
79 | - example: |
80 | - brz register-branch http://foo.com/brz/fooproject.mine \\ |
81 | - --project fooproject |
82 | - """ |
83 | - takes_args = ['public_url?'] |
84 | - takes_options = [ |
85 | - Option('project', |
86 | - 'Launchpad project short name to associate with the branch.', |
87 | - unicode), |
88 | - Option('product', |
89 | - 'Launchpad product short name to associate with the branch.', |
90 | - unicode, |
91 | - hidden=True), |
92 | - Option('branch-name', |
93 | - 'Short name for the branch; ' |
94 | - 'by default taken from the last component of the url.', |
95 | - unicode), |
96 | - Option('branch-title', |
97 | - 'One-sentence description of the branch.', |
98 | - unicode), |
99 | - Option('branch-description', |
100 | - 'Longer description of the purpose or contents of the branch.', |
101 | - unicode), |
102 | - Option('author', |
103 | - "Branch author's email address, if not yourself.", |
104 | - unicode), |
105 | - Option('link-bug', |
106 | - 'The bug this branch fixes.', |
107 | - int), |
108 | - Option('dry-run', |
109 | - 'Prepare the request but don\'t actually send it.') |
110 | - ] |
111 | - |
112 | - |
113 | - def run(self, |
114 | - public_url=None, |
115 | - project='', |
116 | - product=None, |
117 | - branch_name='', |
118 | - branch_title='', |
119 | - branch_description='', |
120 | - author='', |
121 | - link_bug=None, |
122 | - dry_run=False): |
123 | - from .lp_registration import ( |
124 | - BranchRegistrationRequest, BranchBugLinkRequest, |
125 | - DryRunLaunchpadService, LaunchpadService) |
126 | - if public_url is None: |
127 | - try: |
128 | - b = _mod_branch.Branch.open_containing('.')[0] |
129 | - except NotBranchError: |
130 | - raise BzrCommandError(gettext( |
131 | - 'register-branch requires a public ' |
132 | - 'branch url - see brz help register-branch.')) |
133 | - public_url = b.get_public_branch() |
134 | - if public_url is None: |
135 | - raise NoPublicBranch(b) |
136 | - if product is not None: |
137 | - project = product |
138 | - trace.note(gettext( |
139 | - '--product is deprecated; please use --project.')) |
140 | - |
141 | - |
142 | - rego = BranchRegistrationRequest(branch_url=public_url, |
143 | - branch_name=branch_name, |
144 | - branch_title=branch_title, |
145 | - branch_description=branch_description, |
146 | - product_name=project, |
147 | - author_email=author, |
148 | - ) |
149 | - linko = BranchBugLinkRequest(branch_url=public_url, |
150 | - bug_id=link_bug) |
151 | - if not dry_run: |
152 | - service = LaunchpadService() |
153 | - # This gives back the xmlrpc url that can be used for future |
154 | - # operations on the branch. It's not so useful to print to the |
155 | - # user since they can't do anything with it from a web browser; it |
156 | - # might be nice for the server to tell us about an html url as |
157 | - # well. |
158 | - else: |
159 | - # Run on service entirely in memory |
160 | - service = DryRunLaunchpadService() |
161 | - service.gather_user_credentials() |
162 | - rego.submit(service) |
163 | - if link_bug: |
164 | - linko.submit(service) |
165 | - self.outf.write('Branch registered.\n') |
166 | - |
167 | - |
168 | class cmd_launchpad_open(Command): |
169 | __doc__ = """Open a Launchpad branch page in your web browser.""" |
170 | |
171 | |
172 | === modified file 'breezy/plugins/launchpad/lp_registration.py' |
173 | --- breezy/plugins/launchpad/lp_registration.py 2017-05-22 00:56:52 +0000 |
174 | +++ breezy/plugins/launchpad/lp_registration.py 2017-06-02 02:04:52 +0000 |
175 | @@ -1,4 +1,4 @@ |
176 | -# Copyright (C) 2006-2011 Canonical Ltd |
177 | +# Copyright (C) 2006-2017 Canonical Ltd |
178 | # |
179 | # This program is free software; you can redistribute it and/or modify |
180 | # it under the terms of the GNU General Public License as published by |
181 | @@ -145,51 +145,13 @@ |
182 | raise errors.InvalidURL(path=url) |
183 | return cls(lp_instance=lp_instance, **kwargs) |
184 | |
185 | - def get_proxy(self, authenticated): |
186 | + def get_proxy(self): |
187 | """Return the proxy for XMLRPC requests.""" |
188 | - if authenticated: |
189 | - # auth info must be in url |
190 | - # TODO: if there's no registrant email perhaps we should |
191 | - # just connect anonymously? |
192 | - scheme, hostinfo, path = urlsplit(self.service_url)[:3] |
193 | - if '@' in hostinfo: |
194 | - raise AssertionError(hostinfo) |
195 | - if self.registrant_email is None: |
196 | - raise AssertionError() |
197 | - if self.registrant_password is None: |
198 | - raise AssertionError() |
199 | - # TODO: perhaps fully quote the password to make it very slightly |
200 | - # obscured |
201 | - # TODO: can we perhaps add extra Authorization headers |
202 | - # directly to the request, rather than putting this into |
203 | - # the url? perhaps a bit more secure against accidentally |
204 | - # revealing it. std66 s3.2.1 discourages putting the |
205 | - # password in the url. |
206 | - hostinfo = '%s:%s@%s' % (urlutils.quote(self.registrant_email), |
207 | - urlutils.quote(self.registrant_password), |
208 | - hostinfo) |
209 | - url = urlunsplit((scheme, hostinfo, path, '', '')) |
210 | - else: |
211 | - url = self.service_url |
212 | + url = self.service_url |
213 | return xmlrpclib.ServerProxy(url, transport=self.transport) |
214 | |
215 | - def gather_user_credentials(self): |
216 | - """Get the password from the user.""" |
217 | - the_config = config.GlobalConfig() |
218 | - self.registrant_email = the_config.user_email() |
219 | - if self.registrant_password is None: |
220 | - auth = config.AuthenticationConfig() |
221 | - scheme, hostinfo = urlsplit(self.service_url)[:2] |
222 | - prompt = 'launchpad.net password for %s: ' % \ |
223 | - self.registrant_email |
224 | - # We will reuse http[s] credentials if we can, prompt user |
225 | - # otherwise |
226 | - self.registrant_password = auth.get_password(scheme, hostinfo, |
227 | - self.registrant_email, |
228 | - prompt=prompt) |
229 | - |
230 | - def send_request(self, method_name, method_params, authenticated): |
231 | - proxy = self.get_proxy(authenticated) |
232 | + def send_request(self, method_name, method_params): |
233 | + proxy = self.get_proxy() |
234 | method = getattr(proxy, method_name) |
235 | try: |
236 | result = method(*method_params) |
237 | @@ -256,7 +218,6 @@ |
238 | |
239 | # Set this to the XMLRPC method name. |
240 | _methodname = None |
241 | - _authenticated = True |
242 | |
243 | def _request_params(self): |
244 | """Return the arguments to pass to the method""" |
245 | @@ -265,88 +226,22 @@ |
246 | def submit(self, service): |
247 | """Submit request to Launchpad XMLRPC server. |
248 | |
249 | - :param service: LaunchpadService indicating where to send |
250 | - the request and the authentication credentials. |
251 | + :param service: LaunchpadService indicating where to send the request. |
252 | """ |
253 | - return service.send_request(self._methodname, self._request_params(), |
254 | - self._authenticated) |
255 | + return service.send_request(self._methodname, self._request_params()) |
256 | |
257 | |
258 | class DryRunLaunchpadService(LaunchpadService): |
259 | - """Service that just absorbs requests without sending to server. |
260 | - |
261 | - The dummy service does not need authentication. |
262 | - """ |
263 | - |
264 | - def send_request(self, method_name, method_params, authenticated): |
265 | - pass |
266 | - |
267 | - def gather_user_credentials(self): |
268 | - pass |
269 | - |
270 | - |
271 | -class BranchRegistrationRequest(BaseRequest): |
272 | - """Request to tell Launchpad about a brz branch.""" |
273 | - |
274 | - _methodname = 'register_branch' |
275 | - |
276 | - def __init__(self, branch_url, |
277 | - branch_name='', |
278 | - branch_title='', |
279 | - branch_description='', |
280 | - author_email='', |
281 | - product_name='', |
282 | - ): |
283 | - if not branch_url: |
284 | - raise errors.InvalidURL(branch_url, "You need to specify a non-empty branch URL.") |
285 | - self.branch_url = branch_url |
286 | - if branch_name: |
287 | - self.branch_name = branch_name |
288 | - else: |
289 | - self.branch_name = self._find_default_branch_name(self.branch_url) |
290 | - self.branch_title = branch_title |
291 | - self.branch_description = branch_description |
292 | - self.author_email = author_email |
293 | - self.product_name = product_name |
294 | - |
295 | - def _request_params(self): |
296 | - """Return xmlrpc request parameters""" |
297 | - # This must match the parameter tuple expected by Launchpad for this |
298 | - # method |
299 | - return (self.branch_url, |
300 | - self.branch_name, |
301 | - self.branch_title, |
302 | - self.branch_description, |
303 | - self.author_email, |
304 | - self.product_name, |
305 | - ) |
306 | - |
307 | - def _find_default_branch_name(self, branch_url): |
308 | - i = branch_url.rfind('/') |
309 | - return branch_url[i+1:] |
310 | - |
311 | - |
312 | -class BranchBugLinkRequest(BaseRequest): |
313 | - """Request to link a brz branch in Launchpad to a bug.""" |
314 | - |
315 | - _methodname = 'link_branch_to_bug' |
316 | - |
317 | - def __init__(self, branch_url, bug_id): |
318 | - self.bug_id = bug_id |
319 | - self.branch_url = branch_url |
320 | - |
321 | - def _request_params(self): |
322 | - """Return xmlrpc request parameters""" |
323 | - # This must match the parameter tuple expected by Launchpad for this |
324 | - # method |
325 | - return (self.branch_url, self.bug_id, '') |
326 | + """Service that just absorbs requests without sending to server.""" |
327 | + |
328 | + def send_request(self, method_name, method_params): |
329 | + pass |
330 | |
331 | |
332 | class ResolveLaunchpadPathRequest(BaseRequest): |
333 | """Request to resolve the path component of an lp: URL.""" |
334 | |
335 | _methodname = 'resolve_lp_path' |
336 | - _authenticated = False |
337 | |
338 | def __init__(self, path): |
339 | if not path: |
340 | |
341 | === modified file 'breezy/plugins/launchpad/test_register.py' |
342 | --- breezy/plugins/launchpad/test_register.py 2017-05-22 00:56:52 +0000 |
343 | +++ breezy/plugins/launchpad/test_register.py 2017-06-02 02:04:52 +0000 |
344 | @@ -1,4 +1,4 @@ |
345 | -# Copyright (C) 2006-2012, 2016 Canonical Ltd |
346 | +# Copyright (C) 2006-2012, 2016-2017 Canonical Ltd |
347 | # |
348 | # This program is free software; you can redistribute it and/or modify |
349 | # it under the terms of the GNU General Public License as published by |
350 | @@ -15,24 +15,14 @@ |
351 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
352 | |
353 | import base64 |
354 | -import urlparse |
355 | +from io import BytesIO |
356 | import xmlrpclib |
357 | |
358 | -from ... import ( |
359 | - config, |
360 | - tests, |
361 | - ui, |
362 | - ) |
363 | -from ...sixish import ( |
364 | - BytesIO, |
365 | - ) |
366 | from ...tests import TestCaseWithTransport |
367 | |
368 | # local import |
369 | from .lp_registration import ( |
370 | BaseRequest, |
371 | - BranchBugLinkRequest, |
372 | - BranchRegistrationRequest, |
373 | ResolveLaunchpadPathRequest, |
374 | LaunchpadService, |
375 | ) |
376 | @@ -43,11 +33,6 @@ |
377 | # the results passed in. Not sure how to get the transport object back out to |
378 | # validate that its OK - may not be necessary. |
379 | |
380 | -# TODO: Add test for (and implement) other command-line options to set |
381 | -# project, author_email, description. |
382 | - |
383 | -# TODO: project_id is not properly handled -- must be passed in rpc or path. |
384 | - |
385 | class InstrumentedXMLRPCConnection(object): |
386 | """Stands in place of an http connection for the purposes of testing""" |
387 | |
388 | @@ -104,25 +89,15 @@ |
389 | # Python 2.5's xmlrpclib looks for this. |
390 | _use_datetime = False |
391 | |
392 | - def __init__(self, testcase, expect_auth): |
393 | + def __init__(self, testcase): |
394 | self.testcase = testcase |
395 | - self.expect_auth = expect_auth |
396 | self._connection = (None, None) |
397 | |
398 | def make_connection(self, host): |
399 | host, http_headers, x509 = self.get_host_info(host) |
400 | test = self.testcase |
401 | self.connected_host = host |
402 | - if self.expect_auth: |
403 | - auth_hdrs = [v for k,v in http_headers if k == 'Authorization'] |
404 | - if len(auth_hdrs) != 1: |
405 | - raise AssertionError("multiple auth headers: %r" |
406 | - % (auth_hdrs,)) |
407 | - authinfo = auth_hdrs[0] |
408 | - expected_auth = 'testuser@launchpad.net:testpassword' |
409 | - test.assertEqual(authinfo, |
410 | - 'Basic ' + base64.encodestring(expected_auth).strip()) |
411 | - elif http_headers: |
412 | + if http_headers: |
413 | raise AssertionError() |
414 | return InstrumentedXMLRPCConnection(test) |
415 | |
416 | @@ -148,80 +123,22 @@ |
417 | |
418 | class MockLaunchpadService(LaunchpadService): |
419 | |
420 | - def send_request(self, method_name, method_params, authenticated): |
421 | + def send_request(self, method_name, method_params): |
422 | """Stash away the method details rather than sending them to a real server""" |
423 | self.called_method_name = method_name |
424 | self.called_method_params = method_params |
425 | - self.called_authenticated = authenticated |
426 | - |
427 | - |
428 | -class TestBranchRegistration(TestCaseWithTransport): |
429 | + |
430 | + |
431 | +class TestResolveLaunchpadPathRequest(TestCaseWithTransport): |
432 | |
433 | def setUp(self): |
434 | - super(TestBranchRegistration, self).setUp() |
435 | + super(TestResolveLaunchpadPathRequest, self).setUp() |
436 | # make sure we have a reproducible standard environment |
437 | self.overrideEnv('BRZ_LP_XMLRPC_URL', None) |
438 | |
439 | - def test_register_help(self): |
440 | - """register-branch accepts --help""" |
441 | - out, err = self.run_bzr(['register-branch', '--help']) |
442 | - self.assertContainsRe(out, r'Register a branch') |
443 | - |
444 | - def test_register_no_url_no_branch(self): |
445 | - """register-branch command requires parameters""" |
446 | - self.make_repository('.') |
447 | - self.run_bzr_error( |
448 | - ['register-branch requires a public branch url - ' |
449 | - 'see brz help register-branch'], |
450 | - 'register-branch') |
451 | - |
452 | - def test_register_no_url_in_published_branch_no_error(self): |
453 | - b = self.make_branch('.') |
454 | - b.set_public_branch('http://test-server.com/bzr/branch') |
455 | - out, err = self.run_bzr(['register-branch', '--dry-run']) |
456 | - self.assertEqual('Branch registered.\n', out) |
457 | - self.assertEqual('', err) |
458 | - |
459 | - def test_register_no_url_in_unpublished_branch_errors(self): |
460 | - b = self.make_branch('.') |
461 | - out, err = self.run_bzr_error(['no public branch'], |
462 | - ['register-branch', '--dry-run']) |
463 | - self.assertEqual('', out) |
464 | - |
465 | - def test_register_dry_run(self): |
466 | - out, err = self.run_bzr(['register-branch', |
467 | - 'http://test-server.com/bzr/branch', |
468 | - '--dry-run']) |
469 | - self.assertEqual(out, 'Branch registered.\n') |
470 | - |
471 | def test_onto_transport(self): |
472 | - """How the request is sent by transmitting across a mock Transport""" |
473 | - # use a real transport, but intercept at the http/xml layer |
474 | - transport = InstrumentedXMLRPCTransport(self, expect_auth=True) |
475 | - service = LaunchpadService(transport) |
476 | - service.registrant_email = 'testuser@launchpad.net' |
477 | - service.registrant_password = 'testpassword' |
478 | - rego = BranchRegistrationRequest('http://test-server.com/bzr/branch', |
479 | - 'branch-id', |
480 | - 'my test branch', |
481 | - 'description', |
482 | - 'author@launchpad.net', |
483 | - 'product') |
484 | - rego.submit(service) |
485 | - self.assertEqual(transport.connected_host, 'xmlrpc.launchpad.net') |
486 | - self.assertEqual(len(transport.sent_params), 6) |
487 | - self.assertEqual(transport.sent_params, |
488 | - ('http://test-server.com/bzr/branch', # branch_url |
489 | - 'branch-id', # branch_name |
490 | - 'my test branch', # branch_title |
491 | - 'description', |
492 | - 'author@launchpad.net', |
493 | - 'product')) |
494 | - self.assertTrue(transport.got_request) |
495 | - |
496 | - def test_onto_transport_unauthenticated(self): |
497 | - """An unauthenticated request is transmitted across a mock Transport""" |
498 | - transport = InstrumentedXMLRPCTransport(self, expect_auth=False) |
499 | + """A request is transmitted across a mock Transport""" |
500 | + transport = InstrumentedXMLRPCTransport(self) |
501 | service = LaunchpadService(transport) |
502 | resolve = ResolveLaunchpadPathRequest('bzr') |
503 | resolve.submit(service) |
504 | @@ -245,59 +162,12 @@ |
505 | self.assertEqual(service.called_method_name, 'dummy_request') |
506 | self.assertEqual(service.called_method_params, (42,)) |
507 | |
508 | - def test_mock_server_registration(self): |
509 | - """Send registration to mock server""" |
510 | - test_case = self |
511 | - class MockRegistrationService(MockLaunchpadService): |
512 | - def send_request(self, method_name, method_params, authenticated): |
513 | - test_case.assertEqual(method_name, "register_branch") |
514 | - test_case.assertEqual(list(method_params), |
515 | - ['url', 'name', 'title', 'description', 'email', 'name']) |
516 | - test_case.assertEqual(authenticated, True) |
517 | - return 'result' |
518 | - service = MockRegistrationService() |
519 | - rego = BranchRegistrationRequest('url', 'name', 'title', |
520 | - 'description', 'email', 'name') |
521 | - result = rego.submit(service) |
522 | - self.assertEqual(result, 'result') |
523 | - |
524 | - def test_mock_server_registration_with_defaults(self): |
525 | - """Send registration to mock server""" |
526 | - test_case = self |
527 | - class MockRegistrationService(MockLaunchpadService): |
528 | - def send_request(self, method_name, method_params, authenticated): |
529 | - test_case.assertEqual(method_name, "register_branch") |
530 | - test_case.assertEqual(list(method_params), |
531 | - ['http://server/branch', 'branch', '', '', '', '']) |
532 | - test_case.assertEqual(authenticated, True) |
533 | - return 'result' |
534 | - service = MockRegistrationService() |
535 | - rego = BranchRegistrationRequest('http://server/branch') |
536 | - result = rego.submit(service) |
537 | - self.assertEqual(result, 'result') |
538 | - |
539 | - def test_mock_bug_branch_link(self): |
540 | - """Send bug-branch link to mock server""" |
541 | - test_case = self |
542 | - class MockService(MockLaunchpadService): |
543 | - def send_request(self, method_name, method_params, authenticated): |
544 | - test_case.assertEqual(method_name, "link_branch_to_bug") |
545 | - test_case.assertEqual(list(method_params), |
546 | - ['http://server/branch', 1234, '']) |
547 | - test_case.assertEqual(authenticated, True) |
548 | - return 'http://launchpad.net/bug/1234' |
549 | - service = MockService() |
550 | - rego = BranchBugLinkRequest('http://server/branch', 1234) |
551 | - result = rego.submit(service) |
552 | - self.assertEqual(result, 'http://launchpad.net/bug/1234') |
553 | - |
554 | def test_mock_resolve_lp_url(self): |
555 | test_case = self |
556 | class MockService(MockLaunchpadService): |
557 | - def send_request(self, method_name, method_params, authenticated): |
558 | + def send_request(self, method_name, method_params): |
559 | test_case.assertEqual(method_name, "resolve_lp_path") |
560 | test_case.assertEqual(list(method_params), ['bzr']) |
561 | - test_case.assertEqual(authenticated, False) |
562 | return dict(urls=[ |
563 | 'bzr+ssh://bazaar.launchpad.net~bzr/bzr/trunk', |
564 | 'sftp://bazaar.launchpad.net~bzr/bzr/trunk', |
565 | @@ -312,58 +182,3 @@ |
566 | 'sftp://bazaar.launchpad.net~bzr/bzr/trunk', |
567 | 'bzr+http://bazaar.launchpad.net~bzr/bzr/trunk', |
568 | 'http://bazaar.launchpad.net~bzr/bzr/trunk']) |
569 | - |
570 | - |
571 | -class TestGatherUserCredentials(tests.TestCaseInTempDir): |
572 | - |
573 | - def setUp(self): |
574 | - super(TestGatherUserCredentials, self).setUp() |
575 | - # make sure we have a reproducible standard environment |
576 | - self.overrideEnv('BRZ_LP_XMLRPC_URL', None) |
577 | - |
578 | - def test_gather_user_credentials_has_password(self): |
579 | - service = LaunchpadService() |
580 | - service.registrant_password = 'mypassword' |
581 | - # This should be a basic no-op, since we already have the password |
582 | - service.gather_user_credentials() |
583 | - self.assertEqual('mypassword', service.registrant_password) |
584 | - |
585 | - def test_gather_user_credentials_from_auth_conf(self): |
586 | - auth_path = config.authentication_config_filename() |
587 | - service = LaunchpadService() |
588 | - g_conf = config.GlobalStack() |
589 | - g_conf.set('email', 'Test User <test@user.com>') |
590 | - g_conf.store.save() |
591 | - # FIXME: auth_path base dir exists only because bazaar.conf has just |
592 | - # been saved, brittle... -- vila 20120731 |
593 | - f = open(auth_path, 'wb') |
594 | - try: |
595 | - scheme, hostinfo = urlparse.urlsplit(service.service_url)[:2] |
596 | - f.write('[section]\n' |
597 | - 'scheme=%s\n' |
598 | - 'host=%s\n' |
599 | - 'user=test@user.com\n' |
600 | - 'password=testpass\n' |
601 | - % (scheme, hostinfo)) |
602 | - finally: |
603 | - f.close() |
604 | - self.assertIs(None, service.registrant_password) |
605 | - service.gather_user_credentials() |
606 | - self.assertEqual('test@user.com', service.registrant_email) |
607 | - self.assertEqual('testpass', service.registrant_password) |
608 | - |
609 | - def test_gather_user_credentials_prompts(self): |
610 | - service = LaunchpadService() |
611 | - self.assertIs(None, service.registrant_password) |
612 | - g_conf = config.GlobalStack() |
613 | - g_conf.set('email', 'Test User <test@user.com>') |
614 | - g_conf.store.save() |
615 | - ui.ui_factory = tests.TestUIFactory(stdin=u'userpass\n') |
616 | - self.assertIs(None, service.registrant_password) |
617 | - service.gather_user_credentials() |
618 | - self.assertEqual('test@user.com', service.registrant_email) |
619 | - self.assertEqual('userpass', service.registrant_password) |
620 | - self.assertEqual('', ui.ui_factory.stdout.getvalue()) |
621 | - self.assertContainsRe(ui.ui_factory.stderr.getvalue(), |
622 | - 'launchpad.net password for test@user\\.com') |
623 | - |
624 | |
625 | === modified file 'doc/en/release-notes/brz-3.0.txt' |
626 | --- doc/en/release-notes/brz-3.0.txt 2017-05-30 22:59:36 +0000 |
627 | +++ doc/en/release-notes/brz-3.0.txt 2017-06-02 02:04:52 +0000 |
628 | @@ -22,6 +22,15 @@ |
629 | clashes with upstream Bazaar. |
630 | (Martin Packman, Jelmer Vernooij) |
631 | |
632 | + * The ``brz register-branch`` command from the Launchpad plugin has been |
633 | + removed, because it has not worked for at least five years: it relies on |
634 | + password authentication rather than SSO, the relevant systems no longer |
635 | + have firewall-level access to the outside world, and in general the |
636 | + Mirrored branch type is deprecated. Either just push the branch to |
637 | + Launchpad or use code imports instead |
638 | + (https://help.launchpad.net/VcsImports). |
639 | + (Colin Watson, #254567, #483689) |
640 | + |
641 | New Features |
642 | ************ |
643 |
Looks good.