~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revprops.py

  • Committer: Aaron Bentley
  • Date: 2005-12-12 17:14:42 UTC
  • mto: (1185.60.3 Aaron's mergeable stuff)
  • mto: This revision was merged to the branch mainline in revision 1530.
  • Revision ID: abentley@panoramicfeedback.com-20051212171442-c5eeec64016bb1f7
Use unicode pathname in cmd_missing

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.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))