~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge in knit repository use of knits - still not a stable format, but can be experimented with.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 
54
54
        return wt
55
55
 
 
56
    def assertUnsigned(self, repo, revision_id):
 
57
        """Assert that revision_id is not signed in repo."""
 
58
        self.assertFalse(repo.has_signature_for_revision_id(revision_id))
 
59
 
 
60
    def assertSigned(self, repo, revision_id):
 
61
        """Assert that revision_id is signed in repo."""
 
62
        self.assertTrue(repo.has_signature_for_revision_id(revision_id))
 
63
 
56
64
    def test_sign_my_commits(self):
57
65
        #Test re signing of data.
58
66
        wt = self.setup_tree()
60
68
 
61
69
        self.monkey_patch_gpg()
62
70
 
63
 
        self.assertFalse(repo.revision_store.has_id('A', 'sig'))
64
 
        self.assertFalse(repo.revision_store.has_id('B', 'sig'))
65
 
        self.assertFalse(repo.revision_store.has_id('C', 'sig'))
66
 
        self.assertFalse(repo.revision_store.has_id('D', 'sig'))
 
71
        self.assertUnsigned(repo, 'A')
 
72
        self.assertUnsigned(repo, 'B')
 
73
        self.assertUnsigned(repo, 'C')
 
74
        self.assertUnsigned(repo, 'D')
67
75
 
68
76
        self.run_bzr('sign-my-commits')
69
77
 
70
 
        self.assertTrue(repo.revision_store.has_id('A', 'sig'))
71
 
        self.assertTrue(repo.revision_store.has_id('B', 'sig'))
72
 
        self.assertTrue(repo.revision_store.has_id('C', 'sig'))
73
 
        self.assertFalse(repo.revision_store.has_id('D', 'sig'))
 
78
        self.assertSigned(repo, 'A')
 
79
        self.assertSigned(repo, 'B')
 
80
        self.assertSigned(repo, 'C')
 
81
        self.assertUnsigned(repo, 'D')
74
82
            
75
83
    def test_sign_my_commits_location(self):
76
84
        wt = self.setup_tree('other')
80
88
 
81
89
        self.run_bzr('sign-my-commits', 'other')
82
90
 
83
 
        self.assertTrue(repo.revision_store.has_id('A', 'sig'))
84
 
        self.assertTrue(repo.revision_store.has_id('B', 'sig'))
85
 
        self.assertTrue(repo.revision_store.has_id('C', 'sig'))
86
 
        self.assertFalse(repo.revision_store.has_id('D', 'sig'))
 
91
        self.assertSigned(repo, 'A')
 
92
        self.assertSigned(repo, 'B')
 
93
        self.assertSigned(repo, 'C')
 
94
        self.assertUnsigned(repo, 'D')
87
95
 
88
96
    def test_sign_diff_committer(self):
89
97
        wt = self.setup_tree()
93
101
 
94
102
        self.run_bzr('sign-my-commits', '.', 'Alternate <alt@foo.com>')
95
103
 
96
 
        self.assertFalse(repo.revision_store.has_id('A', 'sig'))
97
 
        self.assertFalse(repo.revision_store.has_id('B', 'sig'))
98
 
        self.assertFalse(repo.revision_store.has_id('C', 'sig'))
99
 
        self.assertTrue(repo.revision_store.has_id('D', 'sig'))
 
104
        self.assertUnsigned(repo, 'A')
 
105
        self.assertUnsigned(repo, 'B')
 
106
        self.assertUnsigned(repo, 'C')
 
107
        self.assertSigned(repo, 'D')
100
108
 
101
109
    def test_sign_dry_run(self):
102
110
        wt = self.setup_tree()
107
115
        out = self.run_bzr('sign-my-commits', '--dry-run')[0]
108
116
 
109
117
        self.assertEquals('A\nB\nC\nSigned 3 revisions\n', out)
110
 
        self.assertFalse(repo.revision_store.has_id('A', 'sig'))
111
 
        self.assertFalse(repo.revision_store.has_id('B', 'sig'))
112
 
        self.assertFalse(repo.revision_store.has_id('C', 'sig'))
113
 
        self.assertFalse(repo.revision_store.has_id('D', 'sig'))
114
 
 
 
118
        self.assertUnsigned(repo, 'A')
 
119
        self.assertUnsigned(repo, 'B')
 
120
        self.assertUnsigned(repo, 'C')
 
121
        self.assertUnsigned(repo, 'D')