]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
fix dir tree unit test
authorDavid Stainton <dstainton415@gmail.com>
Fri, 24 Apr 2015 06:47:22 +0000 (07:47 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 28 Apr 2015 18:46:48 +0000 (19:46 +0100)
src/allmydata/frontends/drop_upload.py
src/allmydata/test/test_drop_upload.py

index 0b757cb04683d28097b9a98f3d9a189aa1f17dd4..b1d1cbe726c6c87ea0b9212fcdc367d7332a53be 100644 (file)
@@ -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):
index d90214494da28ceb9ceee0834c41347ae181906b..f5c7443682dc05a70bd0f89176358c2ff4bda76e 100644 (file)
@@ -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