From: robk-tahoe Date: Tue, 18 Mar 2008 20:11:08 +0000 (-0700) Subject: webish mkdir-p: added unit test X-Git-Tag: allmydata-tahoe-1.0.0~28 X-Git-Url: https://git.rkrishnan.org/pf/cyclelanguage?a=commitdiff_plain;h=e75c417bb5ca58de89215336e0fc1c7d76a24756;p=tahoe-lafs%2Ftahoe-lafs.git webish mkdir-p: added unit test added a test for the simple mkdir-p hack I added yesterday checks that mkdir-p can create a directory hierarchy, and that resubmitting a request for the same path yields the existing dir's uri --- diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 4b597d1a..5711af92 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -781,6 +781,25 @@ class Web(WebMixin, unittest.TestCase): d.addCallback(self.failUnlessNodeKeysAre, [u"baz.txt"]) return d + def test_PUT_NEWDIRURL_mkdir_p(self): + d = defer.succeed(None) + d.addCallback(lambda res: self.POST(self.public_url + "/foo", t='mkdir', name='mkp')) + d.addCallback(lambda res: self.failUnlessNodeHasChild(self._foo_node, u"mkp")) + d.addCallback(lambda res: self._foo_node.get(u"mkp")) + def mkdir_p(mkpnode): + url = '/uri/%s?t=mkdir-p&path=/sub1/sub2' % urllib.quote(mkpnode.get_uri()) + d = self.POST(url) + def made_subsub(ssuri): + d = self._foo_node.get_child_at_path(u"mkp/sub1/sub2") + d.addCallback(lambda ssnode: self.failUnlessEqual(ssnode.get_uri(), ssuri)) + d = self.POST(url) + d.addCallback(lambda uri2: self.failUnlessEqual(uri2, ssuri)) + return d + d.addCallback(made_subsub) + return d + d.addCallback(mkdir_p) + return d + def test_PUT_NEWDIRURL_mkdirs(self): d = self.PUT(self.public_url + "/foo/subdir/newdir?t=mkdir", "") d.addCallback(lambda res: