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