/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_log.py

  • Committer: Jelmer Vernooij
  • Date: 2018-03-24 17:48:04 UTC
  • mfrom: (6921 work)
  • mto: This revision was merged to the branch mainline in revision 6923.
  • Revision ID: jelmer@jelmer.uk-20180324174804-xf22o05byoj12x1q
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
317
317
 
318
318
 
319
319
class TestFormatSignatureValidity(tests.TestCaseWithTransport):
320
 
    class UTFLoopbackGPGStrategy(gpg.LoopbackGPGStrategy):
321
 
        def verify(self, content, testament):
322
 
            return (gpg.SIGNATURE_VALID,
323
 
                u'UTF8 Test \xa1\xb1\xc1\xd1\xe1\xf1 <jrandom@example.com>')
324
 
 
325
 
    def has_signature_for_revision_id(self, revision_id):
326
 
        return True
327
 
 
328
 
    def get_signature_text(self, revision_id):
329
 
        return ''
 
320
 
 
321
    def verify_revision_signature(self, revid, gpg_strategy):
 
322
        return (gpg.SIGNATURE_VALID,
 
323
            u'UTF8 Test \xa1\xb1\xc1\xd1\xe1\xf1 <jrandom@example.com>')
330
324
 
331
325
    def test_format_signature_validity_utf(self):
332
326
        """Check that GPG signatures containing UTF-8 names are formatted
333
327
        correctly."""
334
 
        # Monkey patch to use our UTF-8 generating GPGStrategy
335
 
        self.overrideAttr(gpg, 'GPGStrategy', self.UTFLoopbackGPGStrategy)
336
328
        wt = self.make_branch_and_tree('.')
337
329
        revid = wt.commit('empty commit')
338
330
        repo = wt.branch.repository
339
331
        # Monkey patch out checking if this rev is actually signed, since we
340
332
        # can't sign it without a heavier TestCase and LoopbackGPGStrategy
341
333
        # doesn't care anyways.
342
 
        self.overrideAttr(repo, 'has_signature_for_revision_id',
343
 
                self.has_signature_for_revision_id)
344
 
        self.overrideAttr(repo, 'get_signature_text', self.get_signature_text)
 
334
        self.overrideAttr(repo, 'verify_revision_signature',
 
335
                self.verify_revision_signature)
345
336
        out = log.format_signature_validity(revid, wt.branch)
346
337
        self.assertEqual(
347
338
u'valid signature from UTF8 Test \xa1\xb1\xc1\xd1\xe1\xf1 <jrandom@example.com>',