]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
test_web.py: add coverage for POST t=check
authorBrian Warner <warner@allmydata.com>
Wed, 5 Dec 2007 06:49:38 +0000 (23:49 -0700)
committerBrian Warner <warner@allmydata.com>
Wed, 5 Dec 2007 06:49:38 +0000 (23:49 -0700)
docs/webapi.txt
src/allmydata/test/test_web.py
src/allmydata/webish.py

index baee67aecfd89205f03b92cf26bdf0e64139dd93..e2e6aa16b02649e0858799a0909108ad917ec8dd 100644 (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
index 502c670f4029a0cd4f822fdd694d0414f1a55fd3..ca7afad7a403e9be61e04fb1f0fee821902f1d6d 100644 (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
index 1876e74dac25d6f01fee8868712f79e8dd2e4255..4e6c0bad39a340fa16d821620f30f9339056c26c 100644 (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)