/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tests/test_mapping.py

Use dictionary with verifiers rather than requiring testament3-sha1 everywhere.

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
        c.author_timezone = 60 * 3
98
98
        c.author = "Author"
99
99
        mapping = BzrGitMappingv1()
100
 
        rev, roundtrip_revid, testament_sha1 = mapping.import_commit(c,
 
100
        rev, roundtrip_revid, verifiers = mapping.import_commit(c,
101
101
            mapping.revision_id_foreign_to_bzr)
102
102
        self.assertEquals(None, roundtrip_revid)
103
 
        self.assertEquals(None, testament_sha1)
 
103
        self.assertEquals({}, verifiers)
104
104
        self.assertEquals("Some message", rev.message)
105
105
        self.assertEquals("Committer", rev.committer)
106
106
        self.assertEquals("Author", rev.properties['author'])
122
122
        c.author = u"Authér".encode("iso8859-1")
123
123
        c.encoding = "iso8859-1"
124
124
        mapping = BzrGitMappingv1()
125
 
        rev, roundtrip_revid, testament_sha1 = mapping.import_commit(c,
 
125
        rev, roundtrip_revid, verifiers = mapping.import_commit(c,
126
126
            mapping.revision_id_foreign_to_bzr)
127
127
        self.assertEquals(None, roundtrip_revid)
128
 
        self.assertEquals(None, testament_sha1)
 
128
        self.assertEquals({}, verifiers)
129
129
        self.assertEquals(u"Authér", rev.properties['author'])
130
130
        self.assertEquals("iso8859-1", rev.properties["git-explicit-encoding"])
131
131
        self.assertTrue("git-implicit-encoding" not in rev.properties)
141
141
        c.author_timezone = 60 * 3
142
142
        c.author = u"Authér".encode("latin1")
143
143
        mapping = BzrGitMappingv1()
144
 
        rev, roundtrip_revid, testament_sha1 = mapping.import_commit(c,
 
144
        rev, roundtrip_revid, verifiers = mapping.import_commit(c,
145
145
            mapping.revision_id_foreign_to_bzr)
146
146
        self.assertEquals(None, roundtrip_revid)
147
 
        self.assertEquals(None, testament_sha1)
 
147
        self.assertEquals({}, verifiers)
148
148
        self.assertEquals(u"Authér", rev.properties['author'])
149
149
        self.assertEquals("latin1", rev.properties["git-implicit-encoding"])
150
150
        self.assertTrue("git-explicit-encoding" not in rev.properties)
160
160
        c.author_timezone = 60 * 3
161
161
        c.author = u"Authér".encode("utf-8")
162
162
        mapping = BzrGitMappingv1()
163
 
        rev, roundtrip_revid, testament_sha1 = mapping.import_commit(c,
 
163
        rev, roundtrip_revid, verifiers = mapping.import_commit(c,
164
164
            mapping.revision_id_foreign_to_bzr)
165
165
        self.assertEquals(None, roundtrip_revid)
166
 
        self.assertEquals(None, testament_sha1)
 
166
        self.assertEquals({}, verifiers)
167
167
        self.assertEquals(u"Authér", rev.properties['author'])
168
168
        self.assertTrue("git-explicit-encoding" not in rev.properties)
169
169
        self.assertTrue("git-implicit-encoding" not in rev.properties)
180
180
    def assertRoundtripRevision(self, orig_rev):
181
181
        commit = self.mapping.export_commit(orig_rev, "mysha",
182
182
            self._lookup_parent, True, "testamentsha")
183
 
        rev, roundtrip_revid, testament_sha1 = self.mapping.import_commit(
 
183
        rev, roundtrip_revid, verifiers = self.mapping.import_commit(
184
184
            commit, self.mapping.revision_id_foreign_to_bzr)
185
185
        self.assertEquals(rev.revision_id,
186
186
            self.mapping.revision_id_foreign_to_bzr(commit.id))
187
187
        if self.mapping.roundtripping:
188
 
            self.assertEquals("testamentsha", testament_sha1)
 
188
            self.assertEquals({"testament3-sha1": "testamentsha"} , verifiers)
189
189
            self.assertEquals(orig_rev.revision_id, roundtrip_revid)
190
190
            self.assertEquals(orig_rev.properties, rev.properties)
191
191
            self.assertEquals(orig_rev.committer, rev.committer)
194
194
            self.assertEquals(orig_rev.message, rev.message)
195
195
            self.assertEquals(list(orig_rev.parent_ids), list(rev.parent_ids))
196
196
        else:
197
 
            self.assertEquals(None, testament_sha1)
 
197
            self.assertEquals({}, verifiers)
198
198
 
199
199
    def test_simple_commit(self):
200
200
        r = Revision(self.mapping.revision_id_foreign_to_bzr("edf99e6c56495c620f20d5dacff9859ff7119261"))
250
250
        raise NotImplementedError(self.assertRoundtripBlob)
251
251
 
252
252
    def assertRoundtripCommit(self, commit1):
253
 
        rev, roundtrip_revid, testament_sha1 = self.mapping.import_commit(
 
253
        rev, roundtrip_revid, verifiers = self.mapping.import_commit(
254
254
            commit1, self.mapping.revision_id_foreign_to_bzr)
255
255
        commit2 = self.mapping.export_commit(rev, "12341212121212", None,
256
256
            True, None)