~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-18 05:26:22 UTC
  • mto: This revision was merged to the branch mainline in revision 1463.
  • Revision ID: robertc@robertcollins.net-20051018052622-653d638c9e26fde4
fix broken tests

Show diffs side-by-side

added added

removed removed

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