]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
add test coverage for the /stats web page
authorBrian Warner <warner@allmydata.com>
Wed, 13 Feb 2008 20:57:39 +0000 (13:57 -0700)
committerBrian Warner <warner@allmydata.com>
Wed, 13 Feb 2008 20:57:39 +0000 (13:57 -0700)
src/allmydata/test/test_system.py
src/allmydata/test/test_web.py

index e4aa9bd9e8befee59b7b6b1afb253e2feae5b2b4..aaa92d17cf92597d5270e6e622dce07ecde2b811 100644 (file)
@@ -1117,6 +1117,8 @@ class SystemTest(testutil.SignalMixin, testutil.PollMixin, unittest.TestCase):
         d.addCallback(lambda res: self.GET(public + "/subdir3/new.txt"))
         d.addCallback(self.failUnlessEqual, "NEWER contents")
 
+        # check that the status page exists
+        d.addCallback(lambda res: self.GET("status"))
 
         # TODO: mangle the second segment of a file, to test errors that
         # occur after we've already sent some good data, which uses a
index d6f462b438d4ba5372889bbabdf575880e32b443..315e45e308f5ce459dc3c006dd8651a154ee2e66 100644 (file)
@@ -5,7 +5,7 @@ from twisted.trial import unittest
 from twisted.internet import defer
 from twisted.web import client, error, http
 from twisted.python import failure, log
-from allmydata import interfaces, provisioning, uri, webish, upload
+from allmydata import interfaces, provisioning, uri, webish, upload, download
 from allmydata.util import fileutil
 from allmydata.test.common import NonGridDirectoryNode, FakeCHKFileNode, FakeMutableFileNode, create_chk_filenode
 from allmydata.interfaces import IURI, INewDirectoryURI, IReadonlyNewDirectoryURI, IFileURI, IMutableFileURI, IMutableFileNode
@@ -67,6 +67,11 @@ class FakeClient(service.MultiService):
         d.addCallback(_got_data)
         return d
 
+    def list_uploads(self):
+        return [upload.UploadStatus()]
+    def list_downloads(self):
+        return [download.DownloadStatus()]
+
 
 class WebMixin(object):
     def setUp(self):
@@ -361,6 +366,13 @@ class Web(WebMixin, unittest.TestCase):
         d.addCallback(_check4)
         return d
 
+    def test_status(self):
+        d = self.GET("/status")
+        def _check(res):
+            self.failUnless('Current Uploads and Downloads' in res)
+        d.addCallback(_check)
+        return d
+
     def test_GET_FILEURL(self):
         d = self.GET(self.public_url + "/foo/bar.txt")
         d.addCallback(self.failUnlessIsBarDotTxt)