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