/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 breezy/tests/blackbox/test_testament.py

  • Committer: Jelmer Vernooij
  • Date: 2020-02-18 01:57:45 UTC
  • mto: This revision was merged to the branch mainline in revision 7493.
  • Revision ID: jelmer@jelmer.uk-20200218015745-q2ss9tsk74h4nh61
drop use of future.

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 'bzr testament' command"""
18
 
 
19
 
 
20
 
from bzrlib.tests.test_testament import (
 
17
"""Blackbox tests for the 'brz testament' command"""
 
18
 
 
19
import re
 
20
 
 
21
from breezy.tests.test_testament import (
 
22
    osutils,
21
23
    REV_1_SHORT,
22
24
    REV_1_SHORT_STRICT,
23
25
    REV_2_TESTAMENT,
26
28
 
27
29
 
28
30
class TestTestament(TestamentSetup):
29
 
    """Run blackbox tests on 'bzr testament'"""
 
31
    """Run blackbox tests on 'brz testament'"""
30
32
 
31
33
    def test_testament_command(self):
32
34
        """Testament containing a file and a directory."""
33
35
        out, err = self.run_bzr('testament --long')
34
36
        self.assertEqualDiff(err, '')
35
 
        self.assertEqualDiff(out, REV_2_TESTAMENT)
 
37
        self.assertEqualDiff(out, REV_2_TESTAMENT.decode('ascii'))
36
38
 
37
39
    def test_testament_command_2(self):
38
40
        """Command getting short testament of previous version."""
39
41
        out, err = self.run_bzr('testament -r1')
40
42
        self.assertEqualDiff(err, '')
41
 
        self.assertEqualDiff(out, REV_1_SHORT)
 
43
        self.assertEqualDiff(out, REV_1_SHORT.decode('ascii'))
42
44
 
43
45
    def test_testament_command_3(self):
44
46
        """Command getting short testament of previous version."""
45
47
        out, err = self.run_bzr('testament -r1 --strict')
46
48
        self.assertEqualDiff(err, '')
47
 
        self.assertEqualDiff(out, REV_1_SHORT_STRICT)
 
49
        self.assertEqualDiff(out, REV_1_SHORT_STRICT.decode('ascii'))
48
50
 
 
51
    def test_testament_non_ascii(self):
 
52
        self.wt.commit(u"Non \xe5ssci message")
 
53
        long_out, err = self.run_bzr_raw('testament --long', encoding='utf-8')
 
54
        self.assertEqualDiff(err, b'')
 
55
        long_out, err = self.run_bzr_raw('testament --long', encoding='ascii')
 
56
        short_out, err = self.run_bzr_raw('testament', encoding='ascii')
 
57
        self.assertEqualDiff(err, b'')
 
58
        sha1_re = re.compile(b'sha1: (?P<sha1>[a-f0-9]+)$', re.M)
 
59
        sha1 = sha1_re.search(short_out).group('sha1')
 
60
        self.assertEqual(sha1, osutils.sha_string(long_out))