From: Brian Warner Date: Wed, 13 Feb 2008 20:57:39 +0000 (-0700) Subject: add test coverage for the /stats web page X-Git-Tag: allmydata-tahoe-0.8.0~70 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/flags/reliability?a=commitdiff_plain;h=a05020483343a91fc60d32a7cfed1ed81c9c8404;p=tahoe-lafs%2Ftahoe-lafs.git add test coverage for the /stats web page --- diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index e4aa9bd9..aaa92d17 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -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 diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index d6f462b4..315e45e3 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -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)