13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
17
"""Test testaments for gpg signing."""
19
19
# TODO: Testaments with x-bits
23
from bzrlib import osutils
24
from bzrlib.tests import SymlinkFeature, TestCaseWithTransport
24
from bzrlib.tests import TestCaseWithTransport
25
25
from bzrlib.testament import Testament, StrictTestament, StrictTestament3
26
26
from bzrlib.transform import TreeTransform
27
from bzrlib.osutils import has_symlinks
29
30
class TestamentSetup(TestCaseWithTransport):
32
33
super(TestamentSetup, self).setUp()
33
self.wt = self.make_branch_and_tree('.', format='dirstate-with-subtree')
34
self.wt = self.make_branch_and_tree('.', format='experimental-knit2')
34
35
self.wt.set_root_id('TREE_ROT')
35
36
b = self.b = self.wt.branch
36
37
b.nick = "test branch"
98
99
def test_testament_symlinks(self):
99
100
"""Testament containing symlink (where possible)"""
100
self.requireFeature(SymlinkFeature)
101
if not has_symlinks():
101
103
os.symlink('wibble/linktarget', 'link')
102
104
self.wt.add(['link'], ['link-id'])
103
105
self.wt.commit(message='add symlink',
141
143
inventory = self.b.repository.get_inventory('test@user-2')
142
144
testament_1 = self.testament_class()(revision, inventory)
143
145
text_1 = testament_1.as_short_text()
144
text_2 = self.from_revision(self.b.repository,
146
text_2 = self.from_revision(self.b.repository,
145
147
'test@user-2').as_short_text()
146
148
self.assertEqual(text_1, text_2)
149
151
class TestamentTestsStrict(TestamentTests):
151
153
def testament_class(self):
152
154
return StrictTestament
155
157
class TestamentTestsStrict2(TestamentTests):
157
159
def testament_class(self):
158
160
return StrictTestament3
211
213
bazaar-ng testament short form 1
212
214
revision-id: test@user-1
214
""" % osutils.sha(REV_1_TESTAMENT).hexdigest()
216
""" % sha(REV_1_TESTAMENT).hexdigest()
217
219
REV_1_SHORT_STRICT = """\
218
220
bazaar-ng testament short form 2.1
219
221
revision-id: test@user-1
221
""" % osutils.sha(REV_1_STRICT_TESTAMENT).hexdigest()
223
""" % sha(REV_1_STRICT_TESTAMENT).hexdigest()
224
226
REV_1_SHORT_STRICT3 = """\
225
227
bazaar testament short form 3 strict
226
228
revision-id: test@user-1
228
""" % osutils.sha(REV_1_STRICT_TESTAMENT3).hexdigest()
230
""" % sha(REV_1_STRICT_TESTAMENT3).hexdigest()
231
233
REV_2_TESTAMENT = """\
293
295
bazaar-ng testament short form 1
294
296
revision-id: test@user-2
296
""" % osutils.sha(REV_2_TESTAMENT).hexdigest()
298
""" % sha(REV_2_TESTAMENT).hexdigest()
299
301
REV_2_SHORT_STRICT = """\
300
302
bazaar-ng testament short form 2.1
301
303
revision-id: test@user-2
303
""" % osutils.sha(REV_2_STRICT_TESTAMENT).hexdigest()
305
""" % sha(REV_2_STRICT_TESTAMENT).hexdigest()
306
308
REV_2_SHORT_STRICT3 = """\
307
309
bazaar testament short form 3 strict
308
310
revision-id: test@user-2
310
""" % osutils.sha(REV_2_STRICT_TESTAMENT3).hexdigest()
312
""" % sha(REV_2_STRICT_TESTAMENT3).hexdigest()
313
315
REV_PROPS_TESTAMENT = """\