22
22
from sha import sha
25
24
from bzrlib.tests import TestCaseWithTransport
26
from bzrlib.branch import Branch
27
25
from bzrlib.testament import Testament, StrictTestament
28
from bzrlib.trace import mutter
29
26
from bzrlib.transform import TreeTransform
30
27
from bzrlib.osutils import has_symlinks
33
class TestamentTests(TestCaseWithTransport):
30
class TestamentSetup(TestCaseWithTransport):
36
super(TestamentTests, self).setUp()
33
super(TestamentSetup, self).setUp()
37
34
self.wt = self.make_branch_and_tree('.')
38
35
b = self.b = self.wt.branch
39
36
b.nick = "test branch"
57
54
rev_id='test@user-2',
58
55
committer='test@user')
58
class TestamentTests(TestamentSetup):
60
60
def test_null_testament(self):
61
61
"""Testament for a revision with no contents."""
62
62
t = Testament.from_revision(self.b.repository, 'test@user-1')
100
100
actual_short = t.as_short_text()
101
101
self.assertEqualDiff(actual_short, REV_2_SHORT_STRICT)
103
def test_testament_command(self):
104
"""Testament containing a file and a directory."""
105
out, err = self.run_bzr_captured(['testament', '--long'])
106
self.assertEqualDiff(err, '')
107
self.assertEqualDiff(out, REV_2_TESTAMENT)
109
def test_testament_command_2(self):
110
"""Command getting short testament of previous version."""
111
out, err = self.run_bzr_captured(['testament', '-r1'])
112
self.assertEqualDiff(err, '')
113
self.assertEqualDiff(out, REV_1_SHORT)
115
def test_testament_command_3(self):
116
"""Command getting short testament of previous version."""
117
out, err = self.run_bzr_captured(['testament', '-r1', '--strict'])
118
self.assertEqualDiff(err, '')
119
self.assertEqualDiff(out, REV_1_SHORT_STRICT)
121
103
def test_testament_symlinks(self):
122
104
"""Testament containing symlink (where possible)"""
123
105
if not has_symlinks():
153
135
timestamp=1129025493,
155
137
rev_id='test@user-3',
156
committer='test@user')
138
committer='Erik B\xe5gfors <test@user>',
139
revprops={'uni':u'\xb5'}
157
141
t = Testament.from_revision(self.b.repository, 'test@user-3')
158
142
self.assertEqualDiff(
159
143
SAMPLE_UNICODE_TESTAMENT.encode('utf-8'), t.as_text())