| 152 | |
| 153 | def test_unicode(self): |
| 154 | self.basedir = basedir = os.path.join("backupdb", "unicode") |
| 155 | fileutil.make_dirs(basedir) |
| 156 | dbfile = os.path.join(basedir, "dbfile") |
| 157 | bdb = self.create_or_skip(dbfile) |
| 158 | self.failUnless(bdb) |
| 159 | |
| 160 | self.writeto(u"f\u00f6\u00f6.txt", "foo.txt") |
| 161 | files = [fn for fn in os.listdir(basedir) if fn.endswith(".txt")] |
| 162 | self.failUnlessEqual(len(files), 1) |
| 163 | foo_fn = os.path.join(basedir, files[0]) |
| 164 | #print foo_fn, type(foo_fn) |
| 165 | |
| 166 | r = bdb.check_file(foo_fn) |
| 167 | self.failUnlessEqual(r.was_uploaded(), False) |
| 168 | r.did_upload("foo-cap") |
| 169 | |
| 170 | r = bdb.check_file(foo_fn) |
| 171 | self.failUnlessEqual(r.was_uploaded(), "foo-cap") |
| 172 | self.failUnlessEqual(r.should_check(), False) |
| 173 | |
| 174 | bar_fn = self.writeto(u"b\u00e5r.txt", "bar.txt") |
| 175 | #print bar_fn, type(bar_fn) |
| 176 | |
| 177 | r = bdb.check_file(bar_fn) |
| 178 | self.failUnlessEqual(r.was_uploaded(), False) |
| 179 | r.did_upload("bar-cap") |
| 180 | |
| 181 | r = bdb.check_file(bar_fn) |
| 182 | self.failUnlessEqual(r.was_uploaded(), "bar-cap") |
| 183 | self.failUnlessEqual(r.should_check(), False) |