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/status?a=commitdiff_plain;h=9279f33888dd84a4ebe225beeb7c1db09920f3a8;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 0eb9dd45..1d52fd6b 100644 --- a/src/allmydata/frontends/drop_upload.py +++ b/src/allmydata/frontends/drop_upload.py @@ -199,9 +199,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 05a95d5b..7ec55bec 100644 --- a/src/allmydata/test/test_drop_upload.py +++ b/src/allmydata/test/test_drop_upload.py @@ -114,7 +114,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") @@ -125,16 +127,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)) @@ -150,23 +151,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