~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_repository/test_signatures.py

  • Committer: Jelmer Vernooij
  • Date: 2012-04-02 01:44:26 UTC
  • mfrom: (6518 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6519.
  • Revision ID: jelmer@samba.org-20120402014426-0o5qtysohyl006b2
merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
            (gpg.SIGNATURE_VALID, None, ),
127
127
            repo.verify_revision_signature('A', strategy))
128
128
 
 
129
    def test_verify_revision_signatures(self):
 
130
        wt = self.make_branch_and_tree('.')
 
131
        wt.commit("base", allow_pointless=True, rev_id='A')
 
132
        wt.commit("second", allow_pointless=True, rev_id='B')
 
133
        strategy = gpg.LoopbackGPGStrategy(None)
 
134
        repo = wt.branch.repository
 
135
        self.addCleanup(repo.lock_write().unlock)
 
136
        repo.start_write_group()
 
137
        repo.sign_revision('A', strategy)
 
138
        repo.commit_write_group()
 
139
        self.assertEqual('-----BEGIN PSEUDO-SIGNED CONTENT-----\n' +
 
140
                         Testament.from_revision(repo,
 
141
                         'A').as_short_text() +
 
142
                         '-----END PSEUDO-SIGNED CONTENT-----\n',
 
143
                         repo.get_signature_text('A'))
 
144
        self.assertEquals(
 
145
            [('A', gpg.SIGNATURE_VALID, None),
 
146
             ('B', gpg.SIGNATURE_NOT_SIGNED, None)],
 
147
            list(repo.verify_revision_signatures(['A', 'B'], strategy)))
 
148
 
129
149
 
130
150
class TestUnsupportedSignatures(per_repository.TestCaseWithRepository):
131
151