diff --git a/src/allmydata/test/test_backupdb.py b/src/allmydata/test/test_backupdb.py index 31a3d05..9b5f838 100644 --- a/src/allmydata/test/test_backupdb.py +++ b/src/allmydata/test/test_backupdb.py @@ -149,3 +149,35 @@ class BackupDB(unittest.TestCase): stderr = stderr_f.getvalue() self.failUnlessEqual(stderr.strip(), "Unable to handle backupdb version 0") + + def test_unicode(self): + self.basedir = basedir = os.path.join("backupdb", "unicode") + fileutil.make_dirs(basedir) + dbfile = os.path.join(basedir, "dbfile") + bdb = self.create_or_skip(dbfile) + self.failUnless(bdb) + + self.writeto(u"f\u00f6\u00f6.txt", "foo.txt") + files = [fn for fn in os.listdir(basedir) if fn.endswith(".txt")] + self.failUnlessEqual(len(files), 1) + foo_fn = os.path.join(basedir, files[0]) + #print foo_fn, type(foo_fn) + + r = bdb.check_file(foo_fn) + self.failUnlessEqual(r.was_uploaded(), False) + r.did_upload("foo-cap") + + r = bdb.check_file(foo_fn) + self.failUnlessEqual(r.was_uploaded(), "foo-cap") + self.failUnlessEqual(r.should_check(), False) + + bar_fn = self.writeto(u"b\u00e5r.txt", "bar.txt") + #print bar_fn, type(bar_fn) + + r = bdb.check_file(bar_fn) + self.failUnlessEqual(r.was_uploaded(), False) + r.did_upload("bar-cap") + + r = bdb.check_file(bar_fn) + self.failUnlessEqual(r.was_uploaded(), "bar-cap") + self.failUnlessEqual(r.should_check(), False)