~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_testament.py

  • Committer: Martin Pool
  • Date: 2007-04-04 06:17:31 UTC
  • mto: This revision was merged to the branch mainline in revision 2397.
  • Revision ID: mbp@sourcefrog.net-20070404061731-tt2xrzllqhbodn83
Contents of TODO file moved into bug tracker

Show diffs side-by-side

added added

removed removed

Lines of Context:
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):
97
98
 
98
99
    def test_testament_symlinks(self):
99
100
        """Testament containing symlink (where possible)"""
100
 
        self.requireFeature(SymlinkFeature)
 
101
        if not has_symlinks():
 
102
            return
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)
147
 
 
 
149
                    
148
150
 
149
151
class TestamentTestsStrict(TestamentTests):
150
 
 
 
152
    
151
153
    def testament_class(self):
152
154
        return StrictTestament
153
155
 
154
156
 
155
157
class TestamentTestsStrict2(TestamentTests):
156
 
 
 
158
    
157
159
    def testament_class(self):
158
160
        return StrictTestament3
159
161
 
211
213
bazaar-ng testament short form 1
212
214
revision-id: test@user-1
213
215
sha1: %s
214
 
""" % osutils.sha(REV_1_TESTAMENT).hexdigest()
 
216
""" % sha(REV_1_TESTAMENT).hexdigest()
215
217
 
216
218
 
217
219
REV_1_SHORT_STRICT = """\
218
220
bazaar-ng testament short form 2.1
219
221
revision-id: test@user-1
220
222
sha1: %s
221
 
""" % osutils.sha(REV_1_STRICT_TESTAMENT).hexdigest()
 
223
""" % sha(REV_1_STRICT_TESTAMENT).hexdigest()
222
224
 
223
225
 
224
226
REV_1_SHORT_STRICT3 = """\
225
227
bazaar testament short form 3 strict
226
228
revision-id: test@user-1
227
229
sha1: %s
228
 
""" % osutils.sha(REV_1_STRICT_TESTAMENT3).hexdigest()
 
230
""" % sha(REV_1_STRICT_TESTAMENT3).hexdigest()
229
231
 
230
232
 
231
233
REV_2_TESTAMENT = """\
293
295
bazaar-ng testament short form 1
294
296
revision-id: test@user-2
295
297
sha1: %s
296
 
""" % osutils.sha(REV_2_TESTAMENT).hexdigest()
 
298
""" % sha(REV_2_TESTAMENT).hexdigest()
297
299
 
298
300
 
299
301
REV_2_SHORT_STRICT = """\
300
302
bazaar-ng testament short form 2.1
301
303
revision-id: test@user-2
302
304
sha1: %s
303
 
""" % osutils.sha(REV_2_STRICT_TESTAMENT).hexdigest()
 
305
""" % sha(REV_2_STRICT_TESTAMENT).hexdigest()
304
306
 
305
307
 
306
308
REV_2_SHORT_STRICT3 = """\
307
309
bazaar testament short form 3 strict
308
310
revision-id: test@user-2
309
311
sha1: %s
310
 
""" % osutils.sha(REV_2_STRICT_TESTAMENT3).hexdigest()
 
312
""" % sha(REV_2_STRICT_TESTAMENT3).hexdigest()
311
313
 
312
314
 
313
315
REV_PROPS_TESTAMENT = """\