test_web.py: add coverage for POST t=check

This commit is contained in:
Brian Warner 2007-12-04 23:49:38 -07:00
parent 56e02b274b
commit 785f21b9bf
3 changed files with 22 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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)