]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Test fixes after rebasing.
authorDaira Hopwood <daira@jacaranda.org>
Fri, 16 Oct 2015 17:09:24 +0000 (18:09 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Fri, 16 Oct 2015 17:09:24 +0000 (18:09 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/test/test_client.py
src/allmydata/test/test_iputil.py
src/allmydata/test/test_storage.py

index 0163150a8d249743c1c3fe03524d4867cc7db6ac..78ac204b18dedf436c23545fd60c7f8e41234b02 100644 (file)
@@ -1,4 +1,5 @@
 import os, sys
+import mock
 import twisted
 from twisted.trial import unittest
 from twisted.application import service
index ee1fd4186a3f65f3d03a82a5cefe61ab7b7f78cd..e173dfdee57663fba0b465896158aacd0ae4798a 100644 (file)
@@ -6,7 +6,6 @@ from twisted.trial import unittest
 from allmydata.util import iputil
 from allmydata.util.namespace import Namespace
 import allmydata.test.common_util as testutil
-from allmydata.util.namespace import Namespace
 
 
 DOTTED_QUAD_RE=re.compile("^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$")
index b60d1f6d926538aad4da34d206f15bf7f69d04a0..fcd5148d7d1835c8596f12ebc31eb3a175cca4a6 100644 (file)
@@ -5548,15 +5548,26 @@ class WebStatusWithDiskBackend(WithDiskBackend, WebRenderingMixin, unittest.Test
         free_for_nonroot = 3*GB
         reserved         = 1*GB
 
-        server = self.create("test_status_right_disk_stats", reserved_space=GB)
+        server = self.create("test_status_right_disk_stats", reserved_space=reserved)
         expecteddir = server.backend._sharedir
 
+        def call_get_disk_stats(whichdir, reserved_space=0):
+            self.failUnlessEqual(whichdir, expecteddir)
+            self.failUnlessEqual(reserved_space, reserved)
+            used = total - free_for_root
+            avail = max(free_for_nonroot - reserved_space, 0)
+            return {
+              'total': total,
+              'free_for_root': free_for_root,
+              'free_for_nonroot': free_for_nonroot,
+              'used': used,
+              'avail': avail,
+           }
+        self.patch(fileutil, 'get_disk_stats', call_get_disk_stats)
+
         w = StorageStatus(server)
         html = w.renderSynchronously()
 
-        self.failIf([True for args in mock_get_disk_stats.call_args_list if args != ((expecteddir, reserved_space), {})],
-                    (mock_get_disk_stats.call_args_list, expecteddir, reserved_space))
-
         self.failUnlessIn("<h1>Storage Server Status</h1>", html)
         s = remove_tags(html)
         self.failUnlessIn("Total disk space: 5.00 GB", s)