~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2012-01-09 20:55:07 UTC
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120109205507-2i3en5r4w4ohdchj
Use idioms coherently and add comments to make their purpose clearer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
        branch = self.make_branch('non-lp')
46
46
        url = 'http://example.com/non-lp'
47
47
        branch.lock_write()
48
 
        branch.set_public_branch(url)
49
 
        branch.unlock()
 
48
        try:
 
49
            branch.set_public_branch(url)
 
50
        finally:
 
51
            branch.unlock()
50
52
        self.assertEqual(
51
53
            ['bzr: ERROR: %s is not registered on Launchpad.' % url],
52
54
            self.run_open('non-lp', retcode=3))
54
56
    def test_launchpad_branch_with_public_location(self):
55
57
        branch = self.make_branch('lp')
56
58
        branch.lock_write()
57
 
        branch.set_public_branch(
58
 
            'bzr+ssh://bazaar.launchpad.net/~foo/bar/baz')
59
 
        branch.unlock()
 
59
        try:
 
60
            branch.set_public_branch(
 
61
                'bzr+ssh://bazaar.launchpad.net/~foo/bar/baz')
 
62
        finally:
 
63
            branch.unlock()
60
64
        self.assertEqual(
61
65
            ['Opening https://code.launchpad.net/~foo/bar/baz in web '
62
66
             'browser'],
65
69
    def test_launchpad_branch_with_public_and_push_location(self):
66
70
        branch = self.make_branch('lp')
67
71
        branch.lock_write()
68
 
        branch.set_public_branch(
69
 
            'bzr+ssh://bazaar.launchpad.net/~foo/bar/public')
70
 
        branch.set_push_location(
71
 
            'bzr+ssh://bazaar.launchpad.net/~foo/bar/push')
72
 
        branch.unlock()
 
72
        try:
 
73
            branch.set_public_branch(
 
74
                'bzr+ssh://bazaar.launchpad.net/~foo/bar/public')
 
75
            branch.set_push_location(
 
76
                'bzr+ssh://bazaar.launchpad.net/~foo/bar/push')
 
77
        finally:
 
78
            branch.unlock()
73
79
        self.assertEqual(
74
80
            ['Opening https://code.launchpad.net/~foo/bar/public in web '
75
81
             'browser'],
80
86
        # location.
81
87
        branch = self.make_branch('lp')
82
88
        branch.lock_write()
83
 
        branch.set_push_location(
84
 
            'bzr+ssh://bazaar.launchpad.net/~foo/bar/baz')
85
 
        branch.unlock()
 
89
        try:
 
90
            branch.set_push_location(
 
91
                'bzr+ssh://bazaar.launchpad.net/~foo/bar/baz')
 
92
        finally:
 
93
            branch.unlock()
86
94
        self.assertEqual(
87
95
            ['Opening https://code.launchpad.net/~foo/bar/baz in web '
88
96
             'browser'],
101
109
        # lp-open in a subdirectory of a registered branch should work
102
110
        wt = self.make_branch_and_tree('lp')
103
111
        wt.branch.lock_write()
104
 
        wt.branch.set_push_location(
105
 
            'bzr+ssh://bazaar.launchpad.net/~foo/bar/baz')
106
 
        wt.branch.unlock()
 
112
        try:
 
113
            wt.branch.set_push_location(
 
114
                'bzr+ssh://bazaar.launchpad.net/~foo/bar/baz')
 
115
        finally:
 
116
            wt.branch.unlock()
107
117
        self.build_tree(['lp/a/'])
108
118
        self.assertEqual(
109
119
            ['Opening https://code.launchpad.net/~foo/bar/baz in web '