~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/launchpad/test_lp_open.py

  • Committer: Martin
  • Date: 2010-05-25 17:27:52 UTC
  • mfrom: (5254 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5257.
  • Revision ID: gzlist@googlemail.com-20100525172752-amm089xcikv968sw
Merge bzr.dev to unite with similar changes already made

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009 Canonical Ltd
 
1
# Copyright (C) 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
21
21
 
22
22
class TestLaunchpadOpen(TestCaseWithTransport):
23
23
 
24
 
    def run_open(self, location, retcode=0):
25
 
        out, err = self.run_bzr(
26
 
            ['launchpad-open', '--dry-run', location], retcode=retcode)
 
24
    def run_open(self, location, retcode=0, working_dir='.'):
 
25
        out, err = self.run_bzr(['launchpad-open', '--dry-run', location],
 
26
                                retcode=retcode,
 
27
                                working_dir=working_dir)
27
28
        return err.splitlines()
28
29
 
29
30
    def test_non_branch(self):
53
54
        branch.set_public_branch(
54
55
            'bzr+ssh://bazaar.launchpad.net/~foo/bar/baz')
55
56
        self.assertEqual(
56
 
            ['Opening https://code.edge.launchpad.net/~foo/bar/baz in web '
 
57
            ['Opening https://code.launchpad.net/~foo/bar/baz in web '
57
58
             'browser'],
58
59
            self.run_open('lp'))
59
60
 
64
65
        branch.set_push_location(
65
66
            'bzr+ssh://bazaar.launchpad.net/~foo/bar/push')
66
67
        self.assertEqual(
67
 
            ['Opening https://code.edge.launchpad.net/~foo/bar/public in web '
 
68
            ['Opening https://code.launchpad.net/~foo/bar/public in web '
68
69
             'browser'],
69
70
            self.run_open('lp'))
70
71
 
75
76
        branch.set_push_location(
76
77
            'bzr+ssh://bazaar.launchpad.net/~foo/bar/baz')
77
78
        self.assertEqual(
78
 
            ['Opening https://code.edge.launchpad.net/~foo/bar/baz in web '
 
79
            ['Opening https://code.launchpad.net/~foo/bar/baz in web '
79
80
             'browser'],
80
81
            self.run_open('lp'))
81
82
 
84
85
        # location and no push location, then just try to look up the
85
86
        # Launchpad page for that URL.
86
87
        self.assertEqual(
87
 
            ['Opening https://code.edge.launchpad.net/~foo/bar/baz in web '
 
88
            ['Opening https://code.launchpad.net/~foo/bar/baz in web '
88
89
             'browser'],
89
90
            self.run_open('bzr+ssh://bazaar.launchpad.net/~foo/bar/baz'))
 
91
 
 
92
    def test_launchpad_branch_subdirectory(self):
 
93
        # lp-open in a subdirectory of a registered branch should work
 
94
        wt = self.make_branch_and_tree('lp')
 
95
        wt.branch.set_push_location(
 
96
            'bzr+ssh://bazaar.launchpad.net/~foo/bar/baz')
 
97
        self.build_tree(['lp/a/'])
 
98
        self.assertEqual(
 
99
            ['Opening https://code.launchpad.net/~foo/bar/baz in web '
 
100
             'browser'],
 
101
            self.run_open('.', working_dir='lp/a'))