From: Daira Hopwood Date: Sun, 23 Nov 2014 05:46:33 +0000 (+0000) Subject: test_storage_client.py: add test_get_available_space_{old,new}. X-Git-Tag: allmydata-tahoe-1.10.1a1~100 X-Git-Url: https://git.rkrishnan.org/specifications/FOOURL?a=commitdiff_plain;h=c0a2af5d69bbf63d244f3f17ab80f0e16de0fe0d;p=tahoe-lafs%2Ftahoe-lafs.git test_storage_client.py: add test_get_available_space_{old,new}. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/test/test_storage_client.py b/src/allmydata/test/test_storage_client.py new file mode 100644 index 00000000..592e40e3 --- /dev/null +++ b/src/allmydata/test/test_storage_client.py @@ -0,0 +1,30 @@ + +from twisted.trial import unittest +from allmydata.storage_client import NativeStorageServer + + +class NativeStorageServerWithVersion(NativeStorageServer): + def __init__(self,version): + self.version=version + def get_version(self): + return self.version + + +class TestNativeStorageServer(unittest.TestCase): + def test_get_available_space_new(self): + nss = NativeStorageServerWithVersion( + { "http://allmydata.org/tahoe/protocols/storage/v1": + { "maximum-immutable-share-size": 111, + "available-space": 222, + } + }) + self.failUnlessEqual(nss.get_available_space(), 222) + + def test_get_available_space_old(self): + nss = NativeStorageServerWithVersion( + { "http://allmydata.org/tahoe/protocols/storage/v1": + { "maximum-immutable-share-size": 111, + } + }) + self.failUnlessEqual(nss.get_available_space(), 111) +