~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_testament.py

  • Committer: Alexander Belchenko
  • Date: 2006-10-14 08:51:07 UTC
  • mto: (2080.1.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 2081.
  • Revision ID: bialix@ukr.net-20061014085107-8dff865674eed30a
win32 installer: make short info page instead of full GPL license text

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005-2006 by Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
12
12
#
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
16
16
 
17
17
"""Test testaments for gpg signing."""
18
18
 
19
19
# TODO: Testaments with x-bits
20
20
 
21
21
import os
 
22
from sha import sha
22
23
 
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
27
28
 
28
29
 
29
30
class TestamentSetup(TestCaseWithTransport):
30
31
 
31
32
    def setUp(self):
32
33
        super(TestamentSetup, self).setUp()
33
 
        self.wt = self.make_branch_and_tree('.', format='dirstate-with-subtree')
34
 
        self.wt.set_root_id('TREE_ROT')
 
34
        self.wt = self.make_branch_and_tree('.')
35
35
        b = self.b = self.wt.branch
36
36
        b.nick = "test branch"
37
37
        self.wt.commit(message='initial null commit',
97
97
 
98
98
    def test_testament_symlinks(self):
99
99
        """Testament containing symlink (where possible)"""
100
 
        self.requireFeature(SymlinkFeature)
 
100
        if not has_symlinks():
 
101
            return
101
102
        os.symlink('wibble/linktarget', 'link')
102
103
        self.wt.add(['link'], ['link-id'])
103
104
        self.wt.commit(message='add symlink',
141
142
        inventory = self.b.repository.get_inventory('test@user-2')
142
143
        testament_1 = self.testament_class()(revision, inventory)
143
144
        text_1 = testament_1.as_short_text()
144
 
        text_2 = self.from_revision(self.b.repository,
 
145
        text_2 = self.from_revision(self.b.repository, 
145
146
                                    'test@user-2').as_short_text()
146
147
        self.assertEqual(text_1, text_2)
147
 
 
 
148
                    
148
149
 
149
150
class TestamentTestsStrict(TestamentTests):
150
 
 
 
151
    
151
152
    def testament_class(self):
152
153
        return StrictTestament
153
154
 
154
155
 
155
156
class TestamentTestsStrict2(TestamentTests):
156
 
 
 
157
    
157
158
    def testament_class(self):
158
159
        return StrictTestament3
159
160
 
200
201
message:
201
202
  initial null commit
202
203
inventory:
203
 
  directory . TREE_ROT test@user-1 no
 
204
  directory . TREE_ROOT test@user-1 no
204
205
properties:
205
206
  branch-nick:
206
207
    test branch
211
212
bazaar-ng testament short form 1
212
213
revision-id: test@user-1
213
214
sha1: %s
214
 
""" % osutils.sha(REV_1_TESTAMENT).hexdigest()
 
215
""" % sha(REV_1_TESTAMENT).hexdigest()
215
216
 
216
217
 
217
218
REV_1_SHORT_STRICT = """\
218
219
bazaar-ng testament short form 2.1
219
220
revision-id: test@user-1
220
221
sha1: %s
221
 
""" % osutils.sha(REV_1_STRICT_TESTAMENT).hexdigest()
 
222
""" % sha(REV_1_STRICT_TESTAMENT).hexdigest()
222
223
 
223
224
 
224
225
REV_1_SHORT_STRICT3 = """\
225
226
bazaar testament short form 3 strict
226
227
revision-id: test@user-1
227
228
sha1: %s
228
 
""" % osutils.sha(REV_1_STRICT_TESTAMENT3).hexdigest()
 
229
""" % sha(REV_1_STRICT_TESTAMENT3).hexdigest()
229
230
 
230
231
 
231
232
REV_2_TESTAMENT = """\
279
280
message:
280
281
  add files and directories
281
282
inventory:
282
 
  directory . TREE_ROT test@user-1 no
 
283
  directory . TREE_ROOT test@user-2 no
283
284
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
284
285
  directory src src-id test@user-2 no
285
286
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
293
294
bazaar-ng testament short form 1
294
295
revision-id: test@user-2
295
296
sha1: %s
296
 
""" % osutils.sha(REV_2_TESTAMENT).hexdigest()
 
297
""" % sha(REV_2_TESTAMENT).hexdigest()
297
298
 
298
299
 
299
300
REV_2_SHORT_STRICT = """\
300
301
bazaar-ng testament short form 2.1
301
302
revision-id: test@user-2
302
303
sha1: %s
303
 
""" % osutils.sha(REV_2_STRICT_TESTAMENT).hexdigest()
 
304
""" % sha(REV_2_STRICT_TESTAMENT).hexdigest()
304
305
 
305
306
 
306
307
REV_2_SHORT_STRICT3 = """\
307
308
bazaar testament short form 3 strict
308
309
revision-id: test@user-2
309
310
sha1: %s
310
 
""" % osutils.sha(REV_2_STRICT_TESTAMENT3).hexdigest()
 
311
""" % sha(REV_2_STRICT_TESTAMENT3).hexdigest()
311
312
 
312
313
 
313
314
REV_PROPS_TESTAMENT = """\
373
374
message:
374
375
  revision with properties
375
376
inventory:
376
 
  directory . TREE_ROT test@user-1 no
 
377
  directory . TREE_ROOT test@user-3 no
377
378
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
378
379
  directory src src-id test@user-2 no
379
380
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
442
443
message:
443
444
  add symlink
444
445
inventory:
445
 
  directory . TREE_ROT test@user-1 no
 
446
  directory . TREE_ROOT test@user-3 no
446
447
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
447
448
  symlink link link-id wibble/linktarget test@user-3 no
448
449
  directory src src-id test@user-2 no
508
509
message:
509
510
  non-ascii commit \N{COPYRIGHT SIGN} me
510
511
inventory:
511
 
  directory . TREE_ROT test@user-1 no
 
512
  directory . TREE_ROOT test@user-3 no
512
513
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
513
514
  directory src src-id test@user-2 no
514
515
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no