~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_sign_my_commits.py

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import os
21
21
 
22
 
import bzrlib.gpg
 
22
from bzrlib import (
 
23
    gpg,
 
24
    tests,
 
25
    )
23
26
from bzrlib.testament import Testament
24
 
from bzrlib.tests import TestCaseWithTransport
25
27
from bzrlib.workingtree import WorkingTree
26
28
 
27
29
 
28
 
class SignMyCommits(TestCaseWithTransport):
 
30
class SignMyCommits(tests.TestCaseWithTransport):
29
31
 
30
32
    def monkey_patch_gpg(self):
31
33
        """Monkey patch the gpg signing strategy to be a loopback.
33
35
        This also registers the cleanup, so that we will revert to
34
36
        the original gpg strategy when done.
35
37
        """
36
 
        self._oldstrategy = bzrlib.gpg.GPGStrategy
37
 
 
38
38
        # monkey patch gpg signing mechanism
39
 
        bzrlib.gpg.GPGStrategy = bzrlib.gpg.LoopbackGPGStrategy
40
 
 
41
 
        self.addCleanup(self._fix_gpg_strategy)
42
 
 
43
 
    def _fix_gpg_strategy(self):
44
 
        bzrlib.gpg.GPGStrategy = self._oldstrategy
 
39
        self.overrideAttr(gpg, 'GPGStrategy', gpg.LoopbackGPGStrategy)
45
40
 
46
41
    def setup_tree(self, location='.'):
47
42
        wt = self.make_branch_and_tree(location)