/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_re_sign.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
 
19
19
"""Black-box tests for bzr re-sign.
21
21
 
22
22
import os
23
23
 
24
 
import bzrlib.gpg
 
24
from bzrlib import (
 
25
    gpg,
 
26
    tests,
 
27
    )
25
28
from bzrlib.bzrdir import BzrDir
26
29
from bzrlib.testament import Testament
27
 
from bzrlib.tests import TestCaseInTempDir
28
 
 
29
 
 
30
 
class ReSign(TestCaseInTempDir):
 
30
 
 
31
 
 
32
class ReSign(tests.TestCaseInTempDir):
31
33
 
32
34
    def monkey_patch_gpg(self):
33
35
        """Monkey patch the gpg signing strategy to be a loopback.
35
37
        This also registers the cleanup, so that we will revert to
36
38
        the original gpg strategy when done.
37
39
        """
38
 
        self._oldstrategy = bzrlib.gpg.GPGStrategy
39
 
 
40
40
        # monkey patch gpg signing mechanism
41
 
        bzrlib.gpg.GPGStrategy = bzrlib.gpg.LoopbackGPGStrategy
42
 
 
43
 
        self.addCleanup(self._fix_gpg_strategy)
44
 
 
45
 
    def _fix_gpg_strategy(self):
46
 
        bzrlib.gpg.GPGStrategy = self._oldstrategy
 
41
        self.overrideAttr(gpg, 'GPGStrategy', gpg.LoopbackGPGStrategy)
47
42
 
48
43
    def setup_tree(self):
49
44
        wt = BzrDir.create_standalone_workingtree('.')
73
68
 
74
69
        self.run_bzr('re-sign B')
75
70
        self.assertEqualSignature(repo, 'B')
76
 
            
 
71
 
77
72
    def test_resign_range(self):
78
73
        wt = self.setup_tree()
79
74
        repo = wt.branch.repository