]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
web: test (and fix) PUT DIRURL t=uri, which replaces a directory in-place with some...
authorBrian Warner <warner@allmydata.com>
Wed, 29 Oct 2008 04:54:46 +0000 (21:54 -0700)
committerBrian Warner <warner@allmydata.com>
Wed, 29 Oct 2008 04:54:46 +0000 (21:54 -0700)
src/allmydata/test/test_web.py
src/allmydata/web/directory.py

index 754fee3e2a62fcf020c0b28d55b26a2f08ef9bc4..85732704ba0c3391387045264da0741ced95cb77 100644 (file)
@@ -2162,6 +2162,22 @@ class Web(WebMixin, testutil.StallMixin, unittest.TestCase):
         # shorter than we expected.
         return d
 
+    def test_PUT_DIRURL_uri(self):
+        d = self.s.create_empty_dirnode()
+        def _made_dir(dn):
+            new_uri = dn.get_uri()
+            # replace /foo with a new (empty) directory
+            d = self.PUT(self.public_url + "/foo?t=uri", new_uri)
+            d.addCallback(lambda res:
+                          self.failUnlessEqual(res.strip(), new_uri))
+            d.addCallback(lambda res:
+                          self.failUnlessChildURIIs(self.public_root,
+                                                    u"foo",
+                                                    new_uri))
+            return d
+        d.addCallback(_made_dir)
+        return d
+
     def test_PUT_NEWFILEURL_uri(self):
         contents, n, new_uri = self.makefile(8)
         d = self.PUT(self.public_url + "/foo/new.txt?t=uri", new_uri)
index 73ae13fa6af7668c78d3501262e70340d732ac66..04f3ae747d5594860f8fc9b9d30cab0d873b3079 100644 (file)
@@ -159,7 +159,7 @@ class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin):
                 # they're trying to set_uri and that name is already occupied
                 # (by us).
                 raise ExistingChildError()
-            d = self.parentnode.replace_me_with_a_childcap(ctx, replace)
+            d = self.replace_me_with_a_childcap(ctx, replace)
             # TODO: results
             return d