~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revprops.py

  • Committer: Michael Ellerman
  • Date: 2005-12-10 22:11:13 UTC
  • mto: This revision was merged to the branch mainline in revision 1528.
  • Revision ID: michael@ellerman.id.au-20051210221113-99ca561aaab4661e
Simplify handling of DivergedBranches in cmd_pull()

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