bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
3955.3.10
by Jonathan Lange
Blackbox tests, forgot to add these earlier. |
1 |
# Copyright (C) 2009 Canonical Ltd
|
2 |
#
|
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
17 |
"""Tests for the launchpad-open command."""
|
|
18 |
||
19 |
from bzrlib.osutils import abspath |
|
20 |
||
21 |
from bzrlib.tests import TestCaseWithTransport |
|
22 |
||
23 |
||
24 |
class TestLaunchpadOpen(TestCaseWithTransport): |
|
25 |
||
26 |
def run_open(self, location, retcode=0): |
|
27 |
out, err = self.run_bzr( |
|
28 |
['launchpad-open', '--dry-run', location], retcode=retcode) |
|
29 |
return err.splitlines() |
|
30 |
||
31 |
def test_non_branch(self): |
|
32 |
# Running lp-open on a non-branch prints a simple error.
|
|
33 |
self.assertEqual( |
|
34 |
['bzr: ERROR: Not a branch: "%s/".' % abspath('.')], |
|
35 |
self.run_open('.', retcode=3)) |
|
36 |
||
37 |
def test_no_public_location(self): |
|
38 |
self.make_branch('not-public') |
|
39 |
self.assertEqual( |
|
40 |
['bzr: ERROR: There is no public branch set for "%s/".' |
|
41 |
% abspath('not-public')], |
|
42 |
self.run_open('not-public', retcode=3)) |
|
43 |
||
44 |
def test_non_launchpad_branch(self): |
|
45 |
branch = self.make_branch('non-lp') |
|
46 |
url = 'http://example.com/non-lp' |
|
47 |
branch.set_public_branch(url) |
|
48 |
self.assertEqual( |
|
49 |
['bzr: ERROR: %s is not hosted on Launchpad.' % url], |
|
50 |
self.run_open('non-lp', retcode=3)) |
|
51 |
||
52 |
def test_launchpad_branch(self): |
|
53 |
branch = self.make_branch('lp') |
|
54 |
branch.set_public_branch( |
|
55 |
'bzr+ssh://bazaar.launchpad.net/~foo/bar/baz') |
|
56 |
self.assertEqual( |
|
57 |
['Opening https://code.edge.launchpad.net/~foo/bar/baz in web ' |
|
58 |
'browser'], |
|
59 |
self.run_open('lp')) |