From: Daira Hopwood Date: Fri, 16 Oct 2015 17:09:24 +0000 (+0100) Subject: Test fixes after rebasing. X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/flags/(%5B%5E?a=commitdiff_plain;h=2416e17b1edb648462b37559e44790e361baf505;p=tahoe-lafs%2Ftahoe-lafs.git Test fixes after rebasing. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/test/test_client.py b/src/allmydata/test/test_client.py index 0163150a..78ac204b 100644 --- a/src/allmydata/test/test_client.py +++ b/src/allmydata/test/test_client.py @@ -1,4 +1,5 @@ import os, sys +import mock import twisted from twisted.trial import unittest from twisted.application import service diff --git a/src/allmydata/test/test_iputil.py b/src/allmydata/test/test_iputil.py index ee1fd418..e173dfde 100644 --- a/src/allmydata/test/test_iputil.py +++ b/src/allmydata/test/test_iputil.py @@ -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]+$") diff --git a/src/allmydata/test/test_storage.py b/src/allmydata/test/test_storage.py index b60d1f6d..fcd5148d 100644 --- a/src/allmydata/test/test_storage.py +++ b/src/allmydata/test/test_storage.py @@ -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("

Storage Server Status

", html) s = remove_tags(html) self.failUnlessIn("Total disk space: 5.00 GB", s)