~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revprops.py

 * The internal storage of history, and logical branch identity have now
   been split into Branch, and Repository. The common locking and file 
   management routines are now in bzrlib.lockablefiles. 
   (Aaron Bentley, Robert Collins, Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# (C) 2005 Canonical
 
2
 
 
3
"""Tests for revision properties."""
 
4
 
 
5
from bzrlib.branch import Branch
 
6
from bzrlib.tests import TestCaseInTempDir
 
7
 
 
8
class TestRevProps(TestCaseInTempDir):
 
9
    def test_simple_revprops(self):
 
10
        """Simple revision properties"""
 
11
        b = Branch.initialize(u'.')
 
12
        b.nick = 'Nicholas'
 
13
        props = dict(flavor='choc-mint', 
 
14
                     condiment='orange\n  mint\n\tcandy')
 
15
        b.working_tree().commit(message='initial null commit', 
 
16
                 revprops=props,
 
17
                 allow_pointless=True,
 
18
                 rev_id='test@user-1')
 
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')])
 
26
 
 
27
    def test_invalid_revprops(self):
 
28
        """Invalid revision properties"""
 
29
        b = Branch.initialize(u'.')
 
30
        self.assertRaises(ValueError,
 
31
                          b.working_tree().commit, 
 
32
                          message='invalid',
 
33
                          revprops={'what a silly property': 'fine'})
 
34
        self.assertRaises(ValueError,
 
35
                          b.working_tree().commit, 
 
36
                          message='invalid',
 
37
                          revprops=dict(number=13))