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