3
"""Tests for revision properties."""
5
from bzrlib.branch import Branch
6
from bzrlib.tests import TestCaseInTempDir
8
class TestRevProps(TestCaseInTempDir):
9
def test_simple_revprops(self):
10
"""Simple revision properties"""
11
b = Branch.initialize(u'.')
13
props = dict(flavor='choc-mint',
14
condiment='orange\n mint\n\tcandy')
15
b.working_tree().commit(message='initial null commit',
19
rev = b.repository.get_revision('test@user-1')
20
self.assertTrue('flavor' in rev.properties)
21
self.assertEquals(rev.properties['flavor'], 'choc-mint')
22
self.assertEquals(sorted(rev.properties.items()),
23
[('branch-nick', 'Nicholas'),
24
('condiment', 'orange\n mint\n\tcandy'),
25
('flavor', 'choc-mint')])
27
def test_invalid_revprops(self):
28
"""Invalid revision properties"""
29
b = Branch.initialize(u'.')
30
self.assertRaises(ValueError,
31
b.working_tree().commit,
33
revprops={'what a silly property': 'fine'})
34
self.assertRaises(ValueError,
35
b.working_tree().commit,
37
revprops=dict(number=13))