]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
test_web: improve provisioning.py test coverage a bit by using a live web hit
authorBrian Warner <warner@lothar.com>
Tue, 28 Aug 2007 00:26:39 +0000 (17:26 -0700)
committerBrian Warner <warner@lothar.com>
Tue, 28 Aug 2007 00:26:39 +0000 (17:26 -0700)
src/allmydata/test/test_web.py

index e2356a495bd861983941cda0e6945e38bc791baa..d9e61384a237908eca525daad60fe904acb827e8 100644 (file)
@@ -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"