From ed525f74780159c2432436a7625aeb938da6edc2 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 27 Aug 2007 17:26:39 -0700 Subject: [PATCH] test_web: improve provisioning.py test coverage a bit by using a live web hit --- src/allmydata/test/test_web.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index e2356a49..d9e61384 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -319,7 +319,7 @@ class WebMixin(object): else: form.append('Content-Disposition: form-data; name="%s"' % name) form.append('') - form.append(value) + form.append(str(value)) form.append(sep) form[-1] += "--" body = "\r\n".join(form) + "\r\n" @@ -396,6 +396,32 @@ class Web(WebMixin, unittest.TestCase): d.addCallback(_check2) return d + def test_provisioning(self): + d = self.GET("/provisioning/") + def _check(res): + self.failUnless('Tahoe Provisioning Tool' in res) + fields = {'filled': True, + "num_users": int(50e3), + "files_per_user": 1000, + "space_per_user": int(1e9), + "sharing_ratio": 1.0, + "encoding_parameters": "3-of-10", + "num_servers": 30, + "ownership_mode": "A", + "download_rate": 100, + "upload_rate": 10, + "delete_rate": 10, + "lease_timer": 7, + } + return self.POST("/provisioning/", **fields) + + d.addCallback(_check) + def _check2(res): + self.failUnless('Tahoe Provisioning Tool' in res) + self.failUnless("Share space consumed: 167.01TB" in res) + d.addCallback(_check2) + return d + def test_start_html(self): fileutil.make_dirs("web") startfile = "web/start.html" -- 2.45.2