~jelmer/ubuntu/maverick/bzr/2.2.5

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_repository_reference/test_add_signature_text.py

ImportĀ upstreamĀ versionĀ 1.13~rc1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2008 Canonical Ltd
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
 
 
17
"""Tests for add_signature_text on a repository with external references."""
 
18
 
 
19
from bzrlib import errors
 
20
from bzrlib.tests.per_repository_reference import (
 
21
    TestCaseWithExternalReferenceRepository,
 
22
    )
 
23
 
 
24
 
 
25
class TestAddSignatureText(TestCaseWithExternalReferenceRepository):
 
26
 
 
27
    def test_add_signature_text_goes_to_repo(self):
 
28
        # adding a signature only writes to the repository add_signature_text
 
29
        # is called on.
 
30
        tree = self.make_branch_and_tree('sample')
 
31
        revid = tree.commit('one')
 
32
        inv = tree.branch.repository.get_inventory(revid)
 
33
        base = self.make_repository('base')
 
34
        repo = self.make_referring('referring', 'base')
 
35
        repo.lock_write()
 
36
        try:
 
37
            repo.start_write_group()
 
38
            try:
 
39
                rev = tree.branch.repository.get_revision(revid)
 
40
                repo.add_revision(revid, rev, inv=inv)
 
41
                repo.add_signature_text(revid, "text")
 
42
            except:
 
43
                repo.abort_write_group()
 
44
                raise
 
45
            else:
 
46
                repo.commit_write_group()
 
47
        finally:
 
48
            repo.unlock()
 
49
        repo.get_signature_text(revid)
 
50
        self.assertRaises(errors.NoSuchRevision, base.get_signature_text,
 
51
            revid)