15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
from .. import bugtracker, urlutils
19
from . import TestCase, TestCaseWithMemoryTransport
22
class ErrorsTest(TestCaseWithMemoryTransport):
24
def test_unknown_bug_tracker_abbreviation(self):
25
"""Test the formatting of UnknownBugTrackerAbbreviation."""
26
branch = self.make_branch('some_branch')
27
error = bugtracker.UnknownBugTrackerAbbreviation('xxx', branch)
29
"Cannot find registered bug tracker called xxx on %s" % branch,
32
def test_malformed_bug_identifier(self):
33
"""Test the formatting of MalformedBugIdentifier."""
34
error = bugtracker.MalformedBugIdentifier(
35
'bogus', 'reason for bogosity')
37
'Did not understand bug identifier bogus: reason for bogosity. '
38
'See "brz help bugs" for more information on this feature.',
41
def test_incorrect_url(self):
42
err = bugtracker.InvalidBugTrackerURL('foo', 'http://bug.com/')
44
("The URL for bug tracker \"foo\" doesn't contain {id}: "
18
from bzrlib import bugtracker, errors, urlutils
19
from bzrlib.tests import TestCase, TestCaseWithMemoryTransport
49
22
class TestGetBugURL(TestCaseWithMemoryTransport):
81
54
def test_unrecognized_abbreviation_raises_error(self):
82
55
"""If the abbreviation is unrecognized, then raise an error."""
83
56
branch = self.make_branch('some_branch')
84
self.assertRaises(bugtracker.UnknownBugTrackerAbbreviation,
57
self.assertRaises(errors.UnknownBugTrackerAbbreviation,
85
58
bugtracker.get_bug_url, 'xxx', branch, '1234')
86
59
self.assertEqual([('get', 'xxx', branch)], self.tracker_type.log)
157
130
config = branch.get_config()
158
131
config.set_user_option('bugtracker_foo_url', 'http://bugs.com/view.html')
159
132
tracker = bugtracker.tracker_registry.get_tracker('foo', branch)
160
self.assertRaises(bugtracker.InvalidBugTrackerURL, tracker.get_bug_url,
133
self.assertRaises(errors.InvalidBugTrackerURL, tracker.get_bug_url, '1234')
164
136
class TestUniqueIntegerBugTracker(TestCaseWithMemoryTransport):
207
179
tracker = bugtracker.UniqueIntegerBugTracker('xxx',
208
180
'http://bugs.com/')
209
181
self.assertRaises(
210
bugtracker.MalformedBugIdentifier, tracker.check_bug_id, 'red')
182
errors.MalformedBugIdentifier, tracker.check_bug_id, 'red')
212
184
class TestURLParametrizedBugTracker(TestCaseWithMemoryTransport):
213
185
"""Tests for URLParametrizedBugTracker."""
258
230
should raise an error.
260
232
self.assertRaises(
261
bugtracker.MalformedBugIdentifier, self.tracker.get_bug_url, 'bad')
233
errors.MalformedBugIdentifier, self.tracker.get_bug_url, 'bad')
264
236
class TestPropertyEncoding(TestCase):