137
138
'0 commits with unknown keys\n'
138
139
'0 commits not valid\n'
139
140
'1 commit not signed\n', ''), out)
143
class TestSmartServerSignMyCommits(tests.TestCaseWithTransport):
145
def monkey_patch_gpg(self):
146
"""Monkey patch the gpg signing strategy to be a loopback.
148
This also registers the cleanup, so that we will revert to
149
the original gpg strategy when done.
151
# monkey patch gpg signing mechanism
152
self.overrideAttr(gpg, 'GPGStrategy', gpg.LoopbackGPGStrategy)
154
def test_sign_single_commit(self):
155
self.setup_smart_server_with_call_log()
156
t = self.make_branch_and_tree('branch')
157
self.build_tree_contents([('branch/foo', 'thecontents')])
160
self.reset_smart_call_log()
161
self.monkey_patch_gpg()
162
out, err = self.run_bzr(['sign-my-commits', self.get_url('branch')])
163
# This figure represent the amount of work to perform this use case. It
164
# is entirely ok to reduce this number if a test fails due to rpc_count
165
# being too low. If rpc_count increases, more network roundtrips have
166
# become necessary for this use case. Please do not adjust this number
167
# upwards without agreement from bzr's network support maintainers.
168
self.assertLength(15, self.hpss_calls)
169
self.assertLength(1, self.hpss_connections)
170
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
172
def test_verify_commits(self):
173
self.setup_smart_server_with_call_log()
174
t = self.make_branch_and_tree('branch')
175
self.build_tree_contents([('branch/foo', 'thecontents')])
178
self.monkey_patch_gpg()
179
out, err = self.run_bzr(['sign-my-commits', self.get_url('branch')])
180
self.reset_smart_call_log()
181
self.run_bzr('sign-my-commits')
182
out = self.run_bzr(['verify-signatures', self.get_url('branch')])
183
# This figure represent the amount of work to perform this use case. It
184
# is entirely ok to reduce this number if a test fails due to rpc_count
185
# being too low. If rpc_count increases, more network roundtrips have
186
# become necessary for this use case. Please do not adjust this number
187
# upwards without agreement from bzr's network support maintainers.
188
self.assertLength(10, self.hpss_calls)
189
self.assertLength(1, self.hpss_connections)
190
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)