add test coverage for the /stats web page

This commit is contained in:
Brian Warner 2008-02-13 13:57:39 -07:00
parent 8c8bcb6d53
commit a050204833
2 changed files with 15 additions and 1 deletions

View 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

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