~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/test_baz_import.py

  • Committer: Aaron Bentley
  • Date: 2006-11-22 13:08:43 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20061122130843-4eaenjjvsrkk564v
Get encoding working

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
        pybaz.set_my_id("Test User<test@example.org>")
73
73
 
74
74
        self.make_empty_import()
 
75
        self.make_utf8_log()
75
76
 
76
77
        self._empty_tag = 'demo@DONOTUSE/c--empty-tag--0'
77
78
        self._empty_tag_bzr = revision_id(self._empty_tag + '--base-0', None)
167
168
        tree.import_(msg)
168
169
        shutil.rmtree(os.path.join(self._tmpdir, 'tree'))
169
170
 
 
171
    def make_utf8_log(self):
 
172
        self._utf8 = 'demo@DONOTUSE/c--utf8--0'
 
173
        os.mkdir(os.path.join(self._tmpdir, 'tree'))
 
174
        tree = pybaz.init_tree(os.path.join(self._tmpdir, 'tree'), 
 
175
                               self._utf8)
 
176
        msg = tree.log_message()
 
177
        msg["summary"] = u"I am importing now\u1234".encode('utf-8')
 
178
        tree.import_(msg)
 
179
        shutil.rmtree(os.path.join(self._tmpdir, 'tree'))
 
180
 
170
181
    def make_missing_ancestor(self):
171
182
        self._archivegoneroot = os.path.join(self._tmpdir, 'archivegone')
172
183
        self._archive = make_archive('demo-gone@DONOTUSE',
234
245
    def tearDown(self):
235
246
        ResourcedTestCase.tearDownResources(self)
236
247
        TestCaseInTempDir.tearDown(self)
237
 
 
 
248
 
 
249
    def test_import_utf8(self):
 
250
        import_version('output', pybaz.Version(self._baz._utf8), None)
 
251
        branch = Branch.open('output')
 
252
        plain_revid = 'Arch-1:demo@DONOTUSE%c--utf8--0--base-0'
 
253
        self.assertEqual([plain_revid], branch.revision_history())
 
254
        self.assertEqual(u'I am importing now\ufffd\ufffd\ufffd',
 
255
                         branch.repository.get_revision(plain_revid).message)
 
256
        import_version('output2', pybaz.Version(self._baz._utf8), 'utf-8')
 
257
        branch2 = Branch.open('output2')
 
258
        utf8_revid = 'Arch-1-utf-8:demo@DONOTUSE%c--utf8--0--base-0'
 
259
        self.assertEqual([utf8_revid], branch2.revision_history())
 
260
        self.assertEqual(u'I am importing now\u1234',
 
261
                         branch2.repository.get_revision(utf8_revid).message)
 
262
 
238
263
    def test_import_empty(self):
239
264
        import_version('output', pybaz.Version(self._baz._import), None)
240
265
        # expected results: