38
38
self.assertEqual('%s/ticket/1234' % trac_url,
39
39
bugtracker.get_bug_url('twisted', branch, '1234'))
41
def test_unrecognized_tag(self):
42
"""If the tag is unrecognized, then raise a KeyError."""
41
def test_unrecognized_abbreviation(self):
42
"""If the abbreviation is unrecognized, then raise a KeyError."""
43
43
branch = self.make_branch('some_branch')
44
44
self.assertRaises(KeyError,
45
45
bugtracker.get_bug_url, 'xxx', branch, '1234')
60
60
self.assertEqual('http://bugs.com/1234', tracker.get_bug_url('1234'))
61
61
self.assertEqual('http://bugs.com/red', tracker.get_bug_url('red'))
63
def test_returns_tracker_if_tag_matches(self):
63
def test_returns_tracker_if_abbreviation_matches(self):
64
64
"""The get() classmethod should return an instance of the tracker if
65
the given tag matches the tracker's tag.
65
the given abbreviation matches the tracker's abbreviated name.
67
67
class SomeTracker(bugtracker.UniqueBugTracker):
68
abbreviated_bugtracker_name = 'xxx'
69
69
base_url = 'http://bugs.com'
71
71
branch = self.make_branch('some_branch')
72
72
tracker = SomeTracker.get('xxx', branch)
73
self.assertEqual('xxx', tracker.tag)
73
self.assertEqual('xxx', tracker.abbreviated_bugtracker_name)
74
74
self.assertEqual('http://bugs.com/1234', tracker.get_bug_url('1234'))
76
def test_returns_none_if_tag_doesnt_match(self):
77
"""The get() classmethod should return None if the given tag doesn't
78
match the tracker's tag.
76
def test_returns_none_if_abbreviation_doesnt_match(self):
77
"""The get() classmethod should return None if the given abbreviated
78
name doesn't match the tracker's abbreviation.
80
80
class SomeTracker(bugtracker.UniqueBugTracker):
81
abbreviated_bugtracker_name = 'xxx'
82
82
base_url = 'http://bugs.com'
84
84
branch = self.make_branch('some_branch')