/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_testament.py

  • Committer: Robert Collins
  • Date: 2010-05-06 23:41:35 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506234135-yivbzczw1sejxnxc
Lock methods on ``Tree``, ``Branch`` and ``Repository`` are now
expected to return an object which can be used to unlock them. This reduces
duplicate code when using cleanups. The previous 'tokens's returned by
``Branch.lock_write`` and ``Repository.lock_write`` are now attributes
on the result of the lock_write. ``repository.RepositoryWriteLockResult``
and ``branch.BranchWriteLockResult`` document this. (Robert Collins)

``log._get_info_for_log_files`` now takes an add_cleanup callable.
(Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
"""Blackbox tests for the 'brz testament' command"""
18
 
 
19
 
import re
20
 
 
21
 
from breezy.sixish import PY3
22
 
from breezy.tests.test_testament import (
23
 
    osutils,
 
17
"""Blackbox tests for the 'bzr testament' command"""
 
18
 
 
19
 
 
20
from bzrlib.tests.test_testament import (
24
21
    REV_1_SHORT,
25
22
    REV_1_SHORT_STRICT,
26
23
    REV_2_TESTAMENT,
29
26
 
30
27
 
31
28
class TestTestament(TestamentSetup):
32
 
    """Run blackbox tests on 'brz testament'"""
 
29
    """Run blackbox tests on 'bzr testament'"""
33
30
 
34
31
    def test_testament_command(self):
35
32
        """Testament containing a file and a directory."""
36
33
        out, err = self.run_bzr('testament --long')
37
34
        self.assertEqualDiff(err, '')
38
 
        self.assertEqualDiff(out, REV_2_TESTAMENT.decode('ascii'))
 
35
        self.assertEqualDiff(out, REV_2_TESTAMENT)
39
36
 
40
37
    def test_testament_command_2(self):
41
38
        """Command getting short testament of previous version."""
42
39
        out, err = self.run_bzr('testament -r1')
43
40
        self.assertEqualDiff(err, '')
44
 
        self.assertEqualDiff(out, REV_1_SHORT.decode('ascii'))
 
41
        self.assertEqualDiff(out, REV_1_SHORT)
45
42
 
46
43
    def test_testament_command_3(self):
47
44
        """Command getting short testament of previous version."""
48
45
        out, err = self.run_bzr('testament -r1 --strict')
49
46
        self.assertEqualDiff(err, '')
50
 
        self.assertEqualDiff(out, REV_1_SHORT_STRICT.decode('ascii'))
 
47
        self.assertEqualDiff(out, REV_1_SHORT_STRICT)
51
48
 
52
 
    def test_testament_non_ascii(self):
53
 
        self.wt.commit(u"Non \xe5ssci message")
54
 
        long_out, err = self.run_bzr_raw('testament --long', encoding='utf-8')
55
 
        self.assertEqualDiff(err, b'')
56
 
        long_out, err = self.run_bzr_raw('testament --long', encoding='ascii')
57
 
        short_out, err = self.run_bzr_raw('testament', encoding='ascii')
58
 
        self.assertEqualDiff(err, b'')
59
 
        sha1_re = re.compile(b'sha1: (?P<sha1>[a-f0-9]+)$', re.M)
60
 
        sha1 = sha1_re.search(short_out).group('sha1')
61
 
        self.assertEqual(sha1, osutils.sha_string(long_out))