~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_testament.py

  • Committer: Robert Collins
  • Date: 2009-07-07 04:32:13 UTC
  • mto: This revision was merged to the branch mainline in revision 4524.
  • Revision ID: robertc@robertcollins.net-20090707043213-4hjjhgr40iq7gk2d
More informative assertions in xml serialisation.

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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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
23
22
 
24
 
from bzrlib.tests import TestCaseWithTransport
 
23
from bzrlib import osutils
 
24
from bzrlib.tests import SymlinkFeature, TestCaseWithTransport
25
25
from bzrlib.testament import Testament, StrictTestament, StrictTestament3
26
26
from bzrlib.transform import TreeTransform
27
 
from bzrlib.osutils import has_symlinks
28
27
 
29
28
 
30
29
class TestamentSetup(TestCaseWithTransport):
98
97
 
99
98
    def test_testament_symlinks(self):
100
99
        """Testament containing symlink (where possible)"""
101
 
        if not has_symlinks():
102
 
            return
 
100
        self.requireFeature(SymlinkFeature)
103
101
        os.symlink('wibble/linktarget', 'link')
104
102
        self.wt.add(['link'], ['link-id'])
105
103
        self.wt.commit(message='add symlink',
143
141
        inventory = self.b.repository.get_inventory('test@user-2')
144
142
        testament_1 = self.testament_class()(revision, inventory)
145
143
        text_1 = testament_1.as_short_text()
146
 
        text_2 = self.from_revision(self.b.repository, 
 
144
        text_2 = self.from_revision(self.b.repository,
147
145
                                    'test@user-2').as_short_text()
148
146
        self.assertEqual(text_1, text_2)
149
 
                    
 
147
 
150
148
 
151
149
class TestamentTestsStrict(TestamentTests):
152
 
    
 
150
 
153
151
    def testament_class(self):
154
152
        return StrictTestament
155
153
 
156
154
 
157
155
class TestamentTestsStrict2(TestamentTests):
158
 
    
 
156
 
159
157
    def testament_class(self):
160
158
        return StrictTestament3
161
159
 
213
211
bazaar-ng testament short form 1
214
212
revision-id: test@user-1
215
213
sha1: %s
216
 
""" % sha(REV_1_TESTAMENT).hexdigest()
 
214
""" % osutils.sha(REV_1_TESTAMENT).hexdigest()
217
215
 
218
216
 
219
217
REV_1_SHORT_STRICT = """\
220
218
bazaar-ng testament short form 2.1
221
219
revision-id: test@user-1
222
220
sha1: %s
223
 
""" % sha(REV_1_STRICT_TESTAMENT).hexdigest()
 
221
""" % osutils.sha(REV_1_STRICT_TESTAMENT).hexdigest()
224
222
 
225
223
 
226
224
REV_1_SHORT_STRICT3 = """\
227
225
bazaar testament short form 3 strict
228
226
revision-id: test@user-1
229
227
sha1: %s
230
 
""" % sha(REV_1_STRICT_TESTAMENT3).hexdigest()
 
228
""" % osutils.sha(REV_1_STRICT_TESTAMENT3).hexdigest()
231
229
 
232
230
 
233
231
REV_2_TESTAMENT = """\
295
293
bazaar-ng testament short form 1
296
294
revision-id: test@user-2
297
295
sha1: %s
298
 
""" % sha(REV_2_TESTAMENT).hexdigest()
 
296
""" % osutils.sha(REV_2_TESTAMENT).hexdigest()
299
297
 
300
298
 
301
299
REV_2_SHORT_STRICT = """\
302
300
bazaar-ng testament short form 2.1
303
301
revision-id: test@user-2
304
302
sha1: %s
305
 
""" % sha(REV_2_STRICT_TESTAMENT).hexdigest()
 
303
""" % osutils.sha(REV_2_STRICT_TESTAMENT).hexdigest()
306
304
 
307
305
 
308
306
REV_2_SHORT_STRICT3 = """\
309
307
bazaar testament short form 3 strict
310
308
revision-id: test@user-2
311
309
sha1: %s
312
 
""" % sha(REV_2_STRICT_TESTAMENT3).hexdigest()
 
310
""" % osutils.sha(REV_2_STRICT_TESTAMENT3).hexdigest()
313
311
 
314
312
 
315
313
REV_PROPS_TESTAMENT = """\