~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-09-29 22:03:03 UTC
  • mfrom: (5416.2.6 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100929220303-cr95h8iwtggco721
(mbp) Add 'break-lock --force'

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007 Canonical Ltd
 
1
# Copyright (C) 2007-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
117
117
        self.assertEqual('http://bugs.com/1234/view.html',
118
118
                         tracker.get_bug_url('1234'))
119
119
 
 
120
    def test_generic_registered_non_integer(self):
 
121
        branch = self.make_branch('some_branch')
 
122
        config = branch.get_config()
 
123
        config.set_user_option('bugtracker_foo_url', 'http://bugs.com/{id}/view.html')
 
124
        tracker = bugtracker.tracker_registry.get_tracker('foo', branch)
 
125
        self.assertEqual('http://bugs.com/ABC-1234/view.html',
 
126
                         tracker.get_bug_url('ABC-1234'))
 
127
 
120
128
    def test_generic_incorrect_url(self):
121
129
        branch = self.make_branch('some_branch')
122
130
        config = branch.get_config()
173
181
        self.assertRaises(
174
182
            errors.MalformedBugIdentifier, tracker.check_bug_id, 'red')
175
183
 
176
 
 
177
 
class TestURLParametrizedIntegerBugTracker(TestCaseWithMemoryTransport):
178
 
    """Tests for TracTracker."""
 
184
class TestURLParametrizedBugTracker(TestCaseWithMemoryTransport):
 
185
    """Tests for URLParametrizedBugTracker."""
179
186
 
180
187
    def setUp(self):
181
188
        TestCaseWithMemoryTransport.setUp(self)
182
189
        self.url = 'http://twistedmatrix.com/trac'
183
 
        self.tracker = bugtracker.URLParametrizedIntegerBugTracker('some',
184
 
                                                                   'ticket/')
 
190
        self.tracker = bugtracker.URLParametrizedBugTracker('some', 'ticket/')
185
191
 
186
192
    def test_get_with_unsupported_tag(self):
187
193
        """If asked for an unrecognized or unconfigured tag, return None."""
203
209
            urlutils.join(self.url, 'ticket/') + '1234',
204
210
            tracker.get_bug_url('1234'))
205
211
 
 
212
    def test_get_bug_url_for_integer_id(self):
 
213
        self.tracker.check_bug_id('1234')
 
214
 
 
215
    def test_get_bug_url_for_non_integer_id(self):
 
216
        self.tracker.check_bug_id('ABC-1234')
 
217
 
 
218
 
 
219
class TestURLParametrizedIntegerBugTracker(TestCaseWithMemoryTransport):
 
220
    """Tests for URLParametrizedIntegerBugTracker."""
 
221
 
 
222
    def setUp(self):
 
223
        TestCaseWithMemoryTransport.setUp(self)
 
224
        self.url = 'http://twistedmatrix.com/trac'
 
225
        self.tracker = bugtracker.URLParametrizedIntegerBugTracker('some',
 
226
                                                                   'ticket/')
 
227
 
206
228
    def test_get_bug_url_for_bad_bug(self):
207
229
        """When given a bug identifier that is invalid for Trac, get_bug_url
208
230
        should raise an error.