]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - src/allmydata/test/test_storage_client.py
test_storage_client.py: add test_get_available_space_{old,new}.
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / test / test_storage_client.py
1
2 from twisted.trial import unittest
3 from allmydata.storage_client import NativeStorageServer
4
5
6 class NativeStorageServerWithVersion(NativeStorageServer):
7     def __init__(self,version):
8         self.version=version
9     def get_version(self):
10         return self.version
11
12
13 class TestNativeStorageServer(unittest.TestCase):
14     def test_get_available_space_new(self):
15         nss = NativeStorageServerWithVersion(
16             { "http://allmydata.org/tahoe/protocols/storage/v1":
17                 { "maximum-immutable-share-size": 111,
18                   "available-space": 222,
19                 }
20             })
21         self.failUnlessEqual(nss.get_available_space(), 222)
22
23     def test_get_available_space_old(self):
24         nss = NativeStorageServerWithVersion(
25             { "http://allmydata.org/tahoe/protocols/storage/v1":
26                 { "maximum-immutable-share-size": 111,
27                 }
28             })
29         self.failUnlessEqual(nss.get_available_space(), 111)
30