~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bugtracker.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-03-11 13:47:06 UTC
  • mfrom: (5051.3.16 use-branch-open)
  • Revision ID: pqm@pqm.ubuntu.com-20100311134706-kaerqhx3lf7xn6rh
(Jelmer) Pass colocated branch names further down the call stack.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
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
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
18
from bzrlib import bugtracker, errors, urlutils
19
 
from bzrlib.tests import TestCaseWithMemoryTransport
 
19
from bzrlib.tests import TestCase, TestCaseWithMemoryTransport
20
20
 
21
21
 
22
22
class TestGetBugURL(TestCaseWithMemoryTransport):
41
41
        self.tracker_type = TestGetBugURL.TransientTracker
42
42
        self.tracker_type.log = []
43
43
        bugtracker.tracker_registry.register('transient', self.tracker_type)
44
 
        self.addCleanup(lambda:
45
 
                        bugtracker.tracker_registry.remove('transient'))
 
44
        self.addCleanup(bugtracker.tracker_registry.remove, 'transient')
46
45
 
47
46
    def test_get_bug_url_for_transient_tracker(self):
48
47
        branch = self.make_branch('some_branch')
194
193
        """If asked for a valid tag, return a tracker instance that can map bug
195
194
        IDs to <base_url>/<bug_area> + <bug_id>."""
196
195
        bugtracker.tracker_registry.register('some', self.tracker)
197
 
        self.addCleanup(lambda: bugtracker.tracker_registry.remove('some'))
 
196
        self.addCleanup(bugtracker.tracker_registry.remove, 'some')
198
197
 
199
198
        branch = self.make_branch('some_branch')
200
199
        config = branch.get_config()
210
209
        """
211
210
        self.assertRaises(
212
211
            errors.MalformedBugIdentifier, self.tracker.get_bug_url, 'bad')
 
212
 
 
213
 
 
214
class TestPropertyEncoding(TestCase):
 
215
    """Tests for how the bug URLs are encoded as revision properties."""
 
216
 
 
217
    def test_encoding_one(self):
 
218
        self.assertEqual(
 
219
            'http://example.com/bugs/1 fixed',
 
220
            bugtracker.encode_fixes_bug_urls(['http://example.com/bugs/1']))
 
221
 
 
222
    def test_encoding_zero(self):
 
223
        self.assertEqual('', bugtracker.encode_fixes_bug_urls([]))
 
224
 
 
225
    def test_encoding_two(self):
 
226
        self.assertEqual(
 
227
            'http://example.com/bugs/1 fixed\n'
 
228
            'http://example.com/bugs/2 fixed',
 
229
            bugtracker.encode_fixes_bug_urls(
 
230
                ['http://example.com/bugs/1', 'http://example.com/bugs/2']))