1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# Copyright (C) 2006 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
"""Blackbox tests for the 'bzr testament' command"""
import re
from bzrlib.tests.test_testament import (
osutils,
REV_1_SHORT,
REV_1_SHORT_STRICT,
REV_2_TESTAMENT,
TestamentSetup,
)
class TestTestament(TestamentSetup):
"""Run blackbox tests on 'bzr testament'"""
def test_testament_command(self):
"""Testament containing a file and a directory."""
out, err = self.run_bzr('testament --long')
self.assertEqualDiff(err, '')
self.assertEqualDiff(out, REV_2_TESTAMENT)
def test_testament_command_2(self):
"""Command getting short testament of previous version."""
out, err = self.run_bzr('testament -r1')
self.assertEqualDiff(err, '')
self.assertEqualDiff(out, REV_1_SHORT)
def test_testament_command_3(self):
"""Command getting short testament of previous version."""
out, err = self.run_bzr('testament -r1 --strict')
self.assertEqualDiff(err, '')
self.assertEqualDiff(out, REV_1_SHORT_STRICT)
def test_testament_non_ascii(self):
self.wt.commit(u"Non \xe5ssci message")
long_out, err = self.run_bzr('testament --long')
self.assertEqualDiff(err, '')
short_out, err = self.run_bzr('testament')
self.assertEqualDiff(err, '')
sha1_re = re.compile('sha1: (?P<sha1>[a-f0-9]+)$', re.M)
sha1 = sha1_re.search(short_out).group('sha1')
self.assertEqual(sha1, osutils.sha_string(long_out))
|