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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
21
from bzrlib import (
26
25
from bzrlib.branch import Branch
27
from bzrlib.errors import (
29
InvalidLineInBugsProperty,
26
from bzrlib.errors import NoSuchRevision
32
27
from bzrlib.deprecated_graph import Graph
33
28
from bzrlib.revision import (find_present_ancestors,
30
from bzrlib.symbol_versioning import one_three
35
31
from bzrlib.tests import TestCase, TestCaseWithTransport
36
32
from bzrlib.trace import mutter
37
33
from bzrlib.workingtree import WorkingTree
235
231
self.assertEqual(['B'], r.get_apparent_authors())
236
232
r.properties['authors'] = 'C\nD'
237
233
self.assertEqual(['C', 'D'], r.get_apparent_authors())
240
class TestRevisionBugs(TestCase):
241
"""Tests for getting the bugs that a revision is linked to."""
243
def test_no_bugs(self):
244
r = revision.Revision('1')
245
self.assertEqual([], list(r.iter_bugs()))
247
def test_some_bugs(self):
248
r = revision.Revision(
250
'bugs': bugtracker.encode_fixes_bug_urls(
251
['http://example.com/bugs/1',
252
'http://launchpad.net/bugs/1234'])})
254
[('http://example.com/bugs/1', bugtracker.FIXED),
255
('http://launchpad.net/bugs/1234', bugtracker.FIXED)],
258
def test_no_status(self):
259
r = revision.Revision(
260
'1', properties={'bugs': 'http://example.com/bugs/1'})
261
self.assertRaises(InvalidLineInBugsProperty, list, r.iter_bugs())
263
def test_too_much_information(self):
264
r = revision.Revision(
265
'1', properties={'bugs': 'http://example.com/bugs/1 fixed bar'})
266
self.assertRaises(InvalidLineInBugsProperty, list, r.iter_bugs())
268
def test_invalid_status(self):
269
r = revision.Revision(
270
'1', properties={'bugs': 'http://example.com/bugs/1 faxed'})
271
self.assertRaises(InvalidBugStatus, list, r.iter_bugs())