~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revprops.py

  • Committer: Olaf Conradi
  • Date: 2006-03-28 23:30:02 UTC
  • mto: (1661.1.1 bzr.mbp.remember)
  • mto: This revision was merged to the branch mainline in revision 1663.
  • Revision ID: olaf@conradi.org-20060328233002-f6262df0e19c1963
Added testcases for using pull with --remember. Moved remember code to
beginning of cmd_pull. This remembers the location in case of a failure
during pull.

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