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

  • Committer: Jelmer Vernooij
  • Date: 2020-06-19 21:26:53 UTC
  • mfrom: (7490.40.19 work)
  • mto: This revision was merged to the branch mainline in revision 7516.
  • Revision ID: jelmer@jelmer.uk-20200619212653-7j6rgywzczhc8cmj
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    gpg,
22
22
    tests,
23
23
    )
24
 
from breezy.bzr.tests.matchers import ContainsNoVfsCalls
25
24
 
26
25
 
27
26
class SignMyCommits(tests.TestCaseWithTransport):
116
115
        self.assertUnsigned(repo, b'D')
117
116
        self.assertUnsigned(repo, b'E')
118
117
 
119
 
 
120
 
class TestSmartServerSignMyCommits(tests.TestCaseWithTransport):
121
 
 
122
 
    def monkey_patch_gpg(self):
123
 
        """Monkey patch the gpg signing strategy to be a loopback.
124
 
 
125
 
        This also registers the cleanup, so that we will revert to
126
 
        the original gpg strategy when done.
127
 
        """
128
 
        # monkey patch gpg signing mechanism
129
 
        self.overrideAttr(gpg, 'GPGStrategy', gpg.LoopbackGPGStrategy)
130
 
 
131
 
    def test_sign_single_commit(self):
132
 
        self.setup_smart_server_with_call_log()
133
 
        t = self.make_branch_and_tree('branch')
134
 
        self.build_tree_contents([('branch/foo', b'thecontents')])
135
 
        t.add("foo")
136
 
        t.commit("message")
137
 
        self.reset_smart_call_log()
138
 
        self.monkey_patch_gpg()
139
 
        out, err = self.run_bzr(['sign-my-commits', self.get_url('branch')])
140
 
        # This figure represent the amount of work to perform this use case. It
141
 
        # is entirely ok to reduce this number if a test fails due to rpc_count
142
 
        # being too low. If rpc_count increases, more network roundtrips have
143
 
        # become necessary for this use case. Please do not adjust this number
144
 
        # upwards without agreement from bzr's network support maintainers.
145
 
        self.assertLength(15, self.hpss_calls)
146
 
        self.assertLength(1, self.hpss_connections)
147
 
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)