1185.16.35
by Martin Pool
- stub for revision properties |
1 |
# (C) 2005 Canonical
|
2 |
||
3 |
"""Tests for revision properties."""
|
|
4 |
||
5 |
from bzrlib.branch import Branch |
|
6 |
from bzrlib.selftest import TestCaseInTempDir |
|
7 |
||
8 |
class TestRevProps(TestCaseInTempDir): |
|
9 |
def test_simple_revprops(self): |
|
10 |
"""Simple revision properties"""
|
|
11 |
b = Branch.initialize('.') |
|
1185.35.16
by Aaron Bentley
Fixed tests |
12 |
b.nick = 'Nicholas' |
1185.16.35
by Martin Pool
- stub for revision properties |
13 |
props = dict(flavor='choc-mint', |
1185.16.39
by Martin Pool
- constraints on revprops |
14 |
condiment='orange\n mint\n\tcandy') |
1457.1.17
by Robert Collins
Branch.commit() has moved to WorkingTree.commit(). (Robert Collins) |
15 |
b.working_tree().commit(message='initial null commit', |
1185.16.35
by Martin Pool
- stub for revision properties |
16 |
revprops=props, |
17 |
allow_pointless=True, |
|
18 |
rev_id='test@user-1') |
|
1185.16.37
by Martin Pool
- properties are retrieved when revisions are loaded |
19 |
rev = b.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()), |
|
1185.35.16
by Aaron Bentley
Fixed tests |
23 |
[('branch-nick', 'Nicholas'), |
24 |
('condiment', 'orange\n mint\n\tcandy'), |
|
1185.16.37
by Martin Pool
- properties are retrieved when revisions are loaded |
25 |
('flavor', 'choc-mint')]) |
26 |
||
1185.16.39
by Martin Pool
- constraints on revprops |
27 |
def test_invalid_revprops(self): |
28 |
"""Invalid revision properties"""
|
|
29 |
b = Branch.initialize('.') |
|
30 |
self.assertRaises(ValueError, |
|
1457.1.17
by Robert Collins
Branch.commit() has moved to WorkingTree.commit(). (Robert Collins) |
31 |
b.working_tree().commit, |
1185.16.39
by Martin Pool
- constraints on revprops |
32 |
message='invalid', |
33 |
revprops={'what a silly property': 'fine'}) |
|
34 |
self.assertRaises(ValueError, |
|
1457.1.17
by Robert Collins
Branch.commit() has moved to WorkingTree.commit(). (Robert Collins) |
35 |
b.working_tree().commit, |
1185.16.39
by Martin Pool
- constraints on revprops |
36 |
message='invalid', |
37 |
revprops=dict(number=13)) |