From: Brian Warner Date: Wed, 5 Dec 2007 06:49:38 +0000 (-0700) Subject: test_web.py: add coverage for POST t=check X-Git-Url: https://git.rkrishnan.org/pf/content/install.html?a=commitdiff_plain;h=785f21b9bf71ad928b8aada28cf1b47bc932f86d;p=tahoe-lafs%2Ftahoe-lafs.git test_web.py: add coverage for POST t=check --- diff --git a/docs/webapi.txt b/docs/webapi.txt index baee67ae..e2e6aa16 100644 --- a/docs/webapi.txt +++ b/docs/webapi.txt @@ -392,6 +392,15 @@ c. POST forms for 'to_name'. This is unconditional and will replace any child already present under 'to_name', akin to 'mv -f' in unix parlance. + + POST $URL + t=check + + This triggers the FileChecker to determine the current "health" of the + given file, by counting how many shares are available. The results will be + displayed on the directory page containing this file. + + 5. debugging and testing features GET $URL?t=download&localfile=$LOCALPATH diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 502c670f..ca7afad7 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -1342,6 +1342,18 @@ class Web(WebMixin, unittest.TestCase): d.addCallback(self.failUnlessIsEmptyJSON) return d + def test_POST_check(self): + d = self.POST(self.public_url + "/foo", t="check", name="bar.txt") + def _done(res): + # this returns a string form of the results, which are probably + # None since we're using fake filenodes. + # TODO: verify that the check actually happened, by changing + # FakeCHKFileNode to count how many times .check() has been + # called. + pass + d.addCallback(_done) + return d + def test_XMLRPC(self): raise unittest.SkipTest("The XML-RPC interface is not yet implemented. Please use the RESTful interface (documented in docs/webapi.txt) for now.") pass diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py index 1876e74d..4e6c0bad 100644 --- a/src/allmydata/webish.py +++ b/src/allmydata/webish.py @@ -840,7 +840,7 @@ class POSTHandler(rend.Page): d2 = child_node.check() def _done(res): log.msg("checked %s, results %s" % (child_node, res)) - return res + return str(res) d2.addCallback(_done) return d2 d.addCallback(_got_child)