/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 bzrlib/tests/blackbox/test_sign_my_commits.py

  • Committer: Martin von Gagern
  • Date: 2010-04-20 08:47:38 UTC
  • mfrom: (5167 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5195.
  • Revision ID: martin.vgagern@gmx.net-20100420084738-ygymnqmdllzrhpfn
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
"""Black-box tests for bzr sign-my-commits."""
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)
79
74
        self.assertSigned(repo, 'B')
80
75
        self.assertSigned(repo, 'C')
81
76
        self.assertUnsigned(repo, 'D')
82
 
            
 
77
 
83
78
    def test_sign_my_commits_location(self):
84
79
        wt = self.setup_tree('other')
85
80
        repo = wt.branch.repository