~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testrevprops.py

  • Committer: Robert Collins
  • Date: 2005-10-17 11:56:54 UTC
  • mfrom: (1185.16.59)
  • Revision ID: robertc@robertcollins.net-20051017115654-662239e1587524a8
mergeĀ fromĀ martin.

Show diffs side-by-side

added added

removed removed

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