From e89bce21a5927680b5391ddaaee344a1245924ab Mon Sep 17 00:00:00 2001
From: Marcus Wanner <marcus@wanners.net>
Date: Thu, 24 Nov 2011 01:51:42 -0500
Subject: [PATCH] Add unit test for moving a directory

My gut tells me this case sould be tested. The rename suite tests it, so
move's will too.
---
 src/allmydata/test/test_web.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py
index baf00178..5103478f 100644
--- a/src/allmydata/test/test_web.py
+++ b/src/allmydata/test/test_web.py
@@ -3401,6 +3401,24 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
         d.addCallback(self.failUnlessIsBarJSON)
         return d
 
+    def test_POST_move_dir(self):
+        d = self.POST(self.public_url + "/foo", t="move",
+                      from_name="bar.txt", to_dir="empty")
+        d.addCallback(lambda res: self.POST(self.public_url + "/foo",
+                      t="move", from_name="empty", to_dir="sub"))
+        d.addCallback(lambda res:
+                      self.failIfNodeHasChild(self._foo_node, u"empty"))
+        d.addCallback(lambda res:
+                      self.failUnlessNodeHasChild(self._sub_node, u"empty"))
+        d.addCallback(lambda res:
+                      self._sub_node.get_child_at_path(u"empty"))
+        d.addCallback(lambda node:
+                      self.failUnlessNodeHasChild(node, u"bar.txt"))
+        d.addCallback(lambda res:
+                      self.GET(self.public_url + "/foo/sub/empty/bar.txt"))
+        d.addCallback(self.failUnlessIsBarDotTxt)
+        return d
+
     def shouldRedirect(self, res, target=None, statuscode=None, which=""):
         """ If target is not None then the redirection has to go to target.  If
         statuscode is not None then the redirection has to be accomplished with
-- 
2.45.2