21
21
from bzrlib import (
25
26
from bzrlib.branch import Branch
26
from bzrlib.errors import NoSuchRevision
27
from bzrlib.errors import (
29
InvalidLineInBugsProperty,
27
32
from bzrlib.deprecated_graph import Graph
28
33
from bzrlib.revision import (find_present_ancestors,
231
236
self.assertEqual(['B'], r.get_apparent_authors())
232
237
r.properties['authors'] = 'C\nD'
233
238
self.assertEqual(['C', 'D'], r.get_apparent_authors())
241
class TestRevisionBugs(TestCase):
242
"""Tests for getting the bugs that a revision is linked to."""
244
def test_no_bugs(self):
245
r = revision.Revision('1')
246
self.assertEqual([], list(r.iter_bugs()))
248
def test_some_bugs(self):
249
r = revision.Revision(
251
'bugs': bugtracker.encode_fixes_bug_urls(
252
['http://example.com/bugs/1',
253
'http://launchpad.net/bugs/1234'])})
255
[('http://example.com/bugs/1', bugtracker.FIXED),
256
('http://launchpad.net/bugs/1234', bugtracker.FIXED)],
259
def test_no_status(self):
260
r = revision.Revision(
261
'1', properties={'bugs': 'http://example.com/bugs/1'})
262
self.assertRaises(InvalidLineInBugsProperty, list, r.iter_bugs())
264
def test_too_much_information(self):
265
r = revision.Revision(
266
'1', properties={'bugs': 'http://example.com/bugs/1 fixed bar'})
267
self.assertRaises(InvalidLineInBugsProperty, list, r.iter_bugs())
269
def test_invalid_status(self):
270
r = revision.Revision(
271
'1', properties={'bugs': 'http://example.com/bugs/1 faxed'})
272
self.assertRaises(InvalidBugStatus, list, r.iter_bugs())