~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2006-03-10 06:29:53 UTC
  • mfrom: (1608 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1611.
  • Revision ID: mbp@sourcefrog.net-20060310062953-bc1c7ade75c89a7a
[merge] bzr.dev; pycurl not updated for readv yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 
54
54
        return wt
55
55
 
 
56
    def assertEqualSignature(self, repo, revision_id):
 
57
        """Assert a signature is stored correctly in repository."""
 
58
        self.assertEqual(
 
59
            Testament.from_revision(repo, revision_id).as_short_text(),
 
60
            repo.get_signature_text(revision_id))
 
61
 
56
62
    def test_resign(self):
57
63
        #Test re signing of data.
58
64
        wt = self.setup_tree()
61
67
        self.monkey_patch_gpg()
62
68
        self.run_bzr('re-sign', '-r', 'revid:A')
63
69
 
64
 
        self.assertEqual(
65
 
            Testament.from_revision(repo, 'A').as_short_text(),
66
 
            repo.revision_store.get('A', 'sig').read())
 
70
        self.assertEqualSignature(repo, 'A')
67
71
 
68
72
        self.run_bzr('re-sign', 'B')
69
 
        self.assertEqual(
70
 
            Testament.from_revision(repo, 'B').as_short_text(),
71
 
            repo.revision_store.get('B', 'sig').read())
 
73
        self.assertEqualSignature(repo, 'B')
72
74
            
73
75
    def test_resign_range(self):
74
76
        wt = self.setup_tree()
76
78
 
77
79
        self.monkey_patch_gpg()
78
80
        self.run_bzr('re-sign', '-r', '1..')
79
 
        self.assertEqual(
80
 
            Testament.from_revision(repo, 'A').as_short_text(),
81
 
            repo.revision_store.get('A', 'sig').read())
82
 
        self.assertEqual(
83
 
            Testament.from_revision(repo, 'B').as_short_text(),
84
 
            repo.revision_store.get('B', 'sig').read())
85
 
        self.assertEqual(
86
 
            Testament.from_revision(repo, 'C').as_short_text(),
87
 
            repo.revision_store.get('C', 'sig').read())
 
81
        self.assertEqualSignature(repo, 'A')
 
82
        self.assertEqualSignature(repo, 'B')
 
83
        self.assertEqualSignature(repo, 'C')
88
84
 
89
85
    def test_resign_multiple(self):
90
86
        wt = self.setup_tree()
92
88
 
93
89
        self.monkey_patch_gpg()
94
90
        self.run_bzr('re-sign', 'A', 'B', 'C')
95
 
        self.assertEqual(
96
 
            Testament.from_revision(repo, 'A').as_short_text(),
97
 
            repo.revision_store.get('A', 'sig').read())
98
 
        self.assertEqual(
99
 
            Testament.from_revision(repo, 'B').as_short_text(),
100
 
            repo.revision_store.get('B', 'sig').read())
101
 
        self.assertEqual(
102
 
            Testament.from_revision(repo, 'C').as_short_text(),
103
 
            repo.revision_store.get('C', 'sig').read())
104
 
 
105
 
 
 
91
        self.assertEqualSignature(repo, 'A')
 
92
        self.assertEqualSignature(repo, 'B')
 
93
        self.assertEqualSignature(repo, 'C')