]> 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)
committerDavid Stainton <dstainton415@gmail.com>
Fri, 24 Apr 2015 06:47:22 +0000 (07:47 +0100)
src/allmydata/frontends/drop_upload.py
src/allmydata/test/test_drop_upload.py

index 0eb9dd4543163778280d37b19ac90646371bf039..1d52fd6b769713942167e6c5fe2d83f9af1c8ea3 100644 (file)
@@ -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):
index 05a95d5bb85ecf12f67b569f2da509f7077f1103..7ec55bec41d6a8244222557691a16591277db013 100644 (file)
@@ -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