116
116
self.assertUnsigned(repo, 'D')
117
117
self.assertUnsigned(repo, 'E')
119
def test_verify_commits(self):
120
wt = self.setup_tree()
121
self.monkey_patch_gpg()
122
self.run_bzr('sign-my-commits')
123
out = self.run_bzr('verify-signatures', retcode=1)
124
self.assertEquals(('4 commits with valid signatures\n'
125
'0 commits with key now expired\n'
126
'0 commits with unknown keys\n'
127
'0 commits not valid\n'
128
'1 commit not signed\n', ''), out)
130
def test_verify_commits_acceptable_key(self):
131
wt = self.setup_tree()
132
self.monkey_patch_gpg()
133
self.run_bzr('sign-my-commits')
134
out = self.run_bzr(['verify-signatures', '--acceptable-keys=foo,bar'],
136
self.assertEquals(('4 commits with valid signatures\n'
137
'0 commits with key now expired\n'
138
'0 commits with unknown keys\n'
139
'0 commits not valid\n'
140
'1 commit not signed\n', ''), out)
143
120
class TestSmartServerSignMyCommits(tests.TestCaseWithTransport):
168
145
self.assertLength(15, self.hpss_calls)
169
146
self.assertLength(1, self.hpss_connections)
170
147
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)