~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testbranch.py

  • Committer: Robert Collins
  • Date: 2005-10-17 21:57:32 UTC
  • mto: This revision was merged to the branch mainline in revision 1462.
  • Revision ID: robertc@robertcollins.net-20051017215732-08f487800e726748
Allow creation of testaments from uncommitted data, and use that to get signatures before committing revisions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
import os
 
18
 
18
19
from bzrlib.branch import Branch
19
20
from bzrlib.clone import copy_branch
20
21
from bzrlib.commit import commit
21
22
import bzrlib.errors as errors
22
23
from bzrlib.errors import NoSuchRevision, UnlistableBranch, NotBranchError
 
24
import bzrlib.gpg
23
25
from bzrlib.selftest import TestCaseInTempDir
 
26
from bzrlib.selftest.HTTPTestUtil import TestCaseWithWebserver
24
27
from bzrlib.trace import mutter
25
28
import bzrlib.transactions as transactions
26
 
from bzrlib.selftest.HTTPTestUtil import TestCaseWithWebserver
27
29
 
28
30
# TODO: Make a branch using basis branch, and check that it 
29
31
# doesn't request any files that could have been avoided, by 
143
145
        self.assertEquals(b.pending_merges(), [])
144
146
 
145
147
    def test_sign_existing_revision(self):
146
 
        import bzrlib.gpg
147
148
        branch = Branch.initialize('.')
148
149
        branch.commit("base", allow_pointless=True, rev_id='A')
149
150
        from bzrlib.testament import Testament
151
152
        self.assertEqual(Testament.from_revision(branch, 'A').as_short_text(),
152
153
                         branch.revision_store.get('A', 'sig').read())
153
154
 
 
155
    def test_store_signature(self):
 
156
        branch = Branch.initialize('.')
 
157
        branch.store_revision_signature(bzrlib.gpg.LoopbackGPGStrategy(None),
 
158
                                        'FOO', 'A')
 
159
        self.assertEqual('FOO', branch.revision_store.get('A', 'sig').read())
 
160
 
154
161
 
155
162
class TestRemote(TestCaseWithWebserver):
156
163