From: Leif Ryge <leif@synthesize.us>
Date: Sat, 22 Nov 2014 02:12:36 +0000 (+0000)
Subject: tests for "Available" column (#648)
X-Git-Tag: allmydata-tahoe-1.10.1a1~102
X-Git-Url: https://git.rkrishnan.org/%5B/frontends/%22file:/status?a=commitdiff_plain;h=336688165edd32465f059b00aac5dc6b6cb322cb;p=tahoe-lafs%2Ftahoe-lafs.git

tests for "Available" column (#648)

thanks to the anonymous author who posted this on trac
---

diff --git a/src/allmydata/test/test_storage.py b/src/allmydata/test/test_storage.py
index 5c5e2c7c..c63323ad 100644
--- a/src/allmydata/test/test_storage.py
+++ b/src/allmydata/test/test_storage.py
@@ -332,6 +332,12 @@ class Server(unittest.TestCase):
         self.failUnlessIn('maximum-immutable-share-size', sv1)
         self.failUnlessIn('maximum-mutable-share-size', sv1)
 
+    def test_declares_available_space(self):
+        ss = self.create("test_declares_available_space")
+        ver = ss.remote_get_version()
+        sv1 = ver['http://allmydata.org/tahoe/protocols/storage/v1']
+        self.failUnlessIn('available-space', sv1)
+
     def allocate(self, ss, storage_index, sharenums, size, canary=None):
         renew_secret = hashutil.tagged_hash("blah", "%d" % self._lease_secret.next())
         cancel_secret = hashutil.tagged_hash("blah", "%d" % self._lease_secret.next())
diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py
index 14684c38..8c5ead4b 100644
--- a/src/allmydata/test/test_web.py
+++ b/src/allmydata/test/test_web.py
@@ -192,7 +192,7 @@ class FakeDisplayableServer(StubServer):
     def get_nickname(self):
         return self.announcement["nickname"]
     def get_available_space(self):
-        return 0
+        return 123456
 
 class FakeBucketCounter(object):
     def get_state(self):
@@ -620,6 +620,8 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
             self.failUnlessIn(u'<td>fake_nickname \u263A</td>', res_u)
             self.failUnlessIn(u'<div class="nickname">other_nickname \u263B</div>', res_u)
             self.failUnlessIn(u'\u00A9 <a href="https://tahoe-lafs.org/">Tahoe-LAFS Software Foundation', res_u)
+            self.failUnlessIn('<td><h3>Available</h3></td>', res)
+            self.failUnlessIn('123.5kB', res)
 
             self.s.basedir = 'web/test_welcome'
             fileutil.make_dirs("web/test_welcome")