~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Patch Queue Manager
  • Date: 2011-11-14 13:03:31 UTC
  • mfrom: (6257.2.1 skip-signature-tests)
  • Revision ID: pqm@pqm.ubuntu.com-20111114130331-8jhzuhxnrmcq2kzs
(jelmer) Handle repository formats that don't support revision signatures in
 the testsuite. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#     an identical tree without a ghost
34
34
# fetch missing should rewrite the TOC of weaves to list newly available parents.
35
35
 
 
36
    def setUp(self):
 
37
        super(TestSignatures, self).setUp()
 
38
        if not self.repository_format.supports_revision_signatures:
 
39
            raise tests.TestNotApplicable(
 
40
                "repository does not support signing revisions")
 
41
 
36
42
    def test_sign_existing_revision(self):
37
43
        wt = self.make_branch_and_tree('.')
38
44
        wt.commit("base", allow_pointless=True, rev_id='A')
93
99
        d2 = repo.bzrdir.clone(urlutils.local_path_to_url('target'))
94
100
        self.assertEqual(repo.get_signature_text('A'),
95
101
                         d2.open_repository().get_signature_text('A'))
 
102
 
 
103
 
 
104
class TestUnsupportedSignatures(per_repository.TestCaseWithRepository):
 
105
 
 
106
    def test_sign_revision(self):
 
107
        if self.repository_format.supports_revision_signatures:
 
108
            raise tests.TestNotApplicable(
 
109
                "repository supports signing revisions")
 
110
        wt = self.make_branch_and_tree('source')
 
111
        wt.commit('A', allow_pointless=True, rev_id='A')
 
112
        repo = wt.branch.repository
 
113
        repo.lock_write()
 
114
        repo.start_write_group()
 
115
        self.assertRaises(errors.UnsupportedOperation,
 
116
            repo.sign_revision, 'A', gpg.LoopbackGPGStrategy(None))
 
117
        repo.commit_write_group()