~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_sign_my_commits.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-06-30 16:06:19 UTC
  • mfrom: (5971.1.80 bzr-gpgme)
  • Revision ID: pqm@pqm.ubuntu.com-20110630160619-3022zmfchft893nt
(jr) A new command ``bzr verify-signatures`` has been added to check that
 commits
 are correctly signed with trusted keys by GPG. This requires python-gpgme to
 be installed. ``bzr log`` has gained a ``--signatures`` option to list the
 validity of signatures for each commit. New config options
 ``acceptable_keys``
 and ``validate_signatures_in_log`` can be set to control options to these
 commands. (Jonathan Riddell)

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
        self.assertUnsigned(repo, 'C')
115
115
        self.assertUnsigned(repo, 'D')
116
116
        self.assertUnsigned(repo, 'E')
 
117
 
 
118
    def test_verify_commits(self):
 
119
        wt = self.setup_tree()
 
120
        self.monkey_patch_gpg()
 
121
        self.run_bzr('sign-my-commits')
 
122
        out = self.run_bzr('verify-signatures', retcode=1)
 
123
        self.assertEquals(('4 commits with valid signatures\n'
 
124
                           '0 commits with unknown keys\n'
 
125
                           '0 commits not valid\n'
 
126
                           '1 commit not signed\n', ''), out)
 
127
 
 
128
    def test_verify_commits_acceptable_key(self):
 
129
        wt = self.setup_tree()
 
130
        self.monkey_patch_gpg()
 
131
        self.run_bzr('sign-my-commits')
 
132
        out = self.run_bzr(['verify-signatures', '--acceptable-keys=foo,bar'],
 
133
                            retcode=1)
 
134
        self.assertEquals(('4 commits with valid signatures\n'
 
135
                           '0 commits with unknown keys\n'
 
136
                           '0 commits not valid\n'
 
137
                           '1 commit not signed\n', ''), out)