From: Brian Warner Date: Tue, 4 Mar 2008 04:56:23 +0000 (-0700) Subject: test_web: improve upload/download status coverage X-Git-Tag: allmydata-tahoe-0.9.0~79 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20//%22?a=commitdiff_plain;h=abb51e70f393d2eeddc49a7155a7d221e5fd2970;p=tahoe-lafs%2Ftahoe-lafs.git test_web: improve upload/download status coverage --- diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 9678ae52..bba90e7f 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -405,6 +405,29 @@ class Web(WebMixin, unittest.TestCase): d.addCallback(_check_ul) return d + def test_status_numbers(self): + drrm = webish.DownloadResultsRendererMixin() + self.failUnlessEqual(drrm.render_time(None, None), "") + self.failUnlessEqual(drrm.render_time(None, 2.5), "2.50s") + self.failUnlessEqual(drrm.render_time(None, 0.25), "250ms") + self.failUnlessEqual(drrm.render_time(None, 0.0021), "2.1ms") + self.failUnlessEqual(drrm.render_time(None, 0.000123), "123us") + self.failUnlessEqual(drrm.render_rate(None, None), "") + self.failUnlessEqual(drrm.render_rate(None, 2500000), "2.50MBps") + self.failUnlessEqual(drrm.render_rate(None, 30100), "30.1kBps") + self.failUnlessEqual(drrm.render_rate(None, 123), "123Bps") + + urrm = webish.UploadResultsRendererMixin() + self.failUnlessEqual(urrm.render_time(None, None), "") + self.failUnlessEqual(urrm.render_time(None, 2.5), "2.50s") + self.failUnlessEqual(urrm.render_time(None, 0.25), "250ms") + self.failUnlessEqual(urrm.render_time(None, 0.0021), "2.1ms") + self.failUnlessEqual(urrm.render_time(None, 0.000123), "123us") + self.failUnlessEqual(urrm.render_rate(None, None), "") + self.failUnlessEqual(urrm.render_rate(None, 2500000), "2.50MBps") + self.failUnlessEqual(urrm.render_rate(None, 30100), "30.1kBps") + self.failUnlessEqual(urrm.render_rate(None, 123), "123Bps") + def test_GET_FILEURL(self): d = self.GET(self.public_url + "/foo/bar.txt") d.addCallback(self.failUnlessIsBarDotTxt)