From abb51e70f393d2eeddc49a7155a7d221e5fd2970 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 3 Mar 2008 21:56:23 -0700 Subject: [PATCH] test_web: improve upload/download status coverage --- src/allmydata/test/test_web.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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) -- 2.45.2