From: David Stainton Date: Fri, 24 Apr 2015 06:47:22 +0000 (+0100) Subject: fix dir tree unit test X-Git-Url: https://git.rkrishnan.org/simplejson/components/frontends/%22news.html/?a=commitdiff_plain;h=0c9d793b2aa2906f029f318f710941558e9bef3d;p=tahoe-lafs%2Ftahoe-lafs.git fix dir tree unit test --- diff --git a/src/allmydata/frontends/drop_upload.py b/src/allmydata/frontends/drop_upload.py index 0b757cb0..b1d1cbe7 100644 --- a/src/allmydata/frontends/drop_upload.py +++ b/src/allmydata/frontends/drop_upload.py @@ -204,9 +204,7 @@ class DropUploader(service.MultiService): if sys.platform != "win32": name = name.decode(get_filesystem_encoding()) # XXX - dirname = path.decode(get_filesystem_encoding()) - #dirname = path - + dirname = path return self._parent.create_subdirectory(name) def _maybe_upload(val): diff --git a/src/allmydata/test/test_drop_upload.py b/src/allmydata/test/test_drop_upload.py index d9021449..f5c74436 100644 --- a/src/allmydata/test/test_drop_upload.py +++ b/src/allmydata/test/test_drop_upload.py @@ -115,7 +115,9 @@ class DropUploadTestMixin(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, NonA return d def _test_move_tree(self): + print "_test_move_tree" self.uploader = None + self.dir_node = None self.set_up_grid() self.local_dir = os.path.join(self.basedir, u"l\u00F8cal_dir") @@ -126,16 +128,15 @@ class DropUploadTestMixin(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, NonA d = self.client.create_dirnode() d.addCallback(self._made_upload_dir) + d.addCallback(self._create_uploader) def testMoveEmptyTree(res): - tree_name = 'empty_tree' + tree_name = u'empty_tree' tree_dir = os.path.join(self.basedir, tree_name) - os.mkdir(tree_dir) - + self.mkdir_nonascii(tree_dir) d2 = defer.Deferred() self.uploader.set_uploaded_callback(d2.callback, ignore_count=0) - new_tree_dir = os.path.join(self.local_dir, tree_name) os.rename(tree_dir, new_tree_dir) self.notify_close_write(FilePath(new_tree_dir)) @@ -151,23 +152,19 @@ class DropUploadTestMixin(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, NonA tree_dir = os.path.join(self.basedir, tree_name) os.mkdir(tree_dir) f = open(os.path.join(tree_dir, 'what'), "wb") - f.write("meow") + f.write("say when") f.close() - d2 = defer.Deferred() self.uploader.set_uploaded_callback(d2.callback, ignore_count=1) - new_tree_dir = os.path.join(self.local_dir, tree_name) os.rename(tree_dir, new_tree_dir) self.notify_close_write(FilePath(new_tree_dir)) return d2 - d.addCallback(testMoveSmallTree) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.objects_uploaded'), 3)) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.directories_created'), 2)) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.files_uploaded'), 1)) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.objects_queued'), 0)) - d.addBoth(self._cleanup) return d