From: Mark Berger Date: Fri, 26 Jul 2013 18:26:48 +0000 (-0400) Subject: Expands leasedb tests X-Git-Url: https://git.rkrishnan.org/reedownlee?a=commitdiff_plain;h=50a617f7c629d316e0e5a9f63576f119ac9f8749;p=tahoe-lafs%2Ftahoe-lafs.git Expands leasedb tests --- diff --git a/src/allmydata/test/test_leasedb.py b/src/allmydata/test/test_leasedb.py index d95524dc..5b163608 100644 --- a/src/allmydata/test/test_leasedb.py +++ b/src/allmydata/test/test_leasedb.py @@ -86,6 +86,29 @@ class DB(unittest.TestCase): "INSERT INTO `leases` VALUES(?,?,?,?,?)", ('si1', 0, LeaseDB.ANONYMOUS_ACCOUNTID, 0, 0)) + num_shares, total_leased_used_space = l.get_total_leased_sharecount_and_used_space() + num_sharesets = l.get_number_of_sharesets() + self.failUnlessEqual(total_leased_used_space, 12345) + self.failUnlessEqual(num_shares, 1) + self.failUnlessEqual(num_sharesets, 1) + + l.add_new_share('si1', 1, 12345, SHARETYPE_IMMUTABLE) + l.add_starter_lease('si1', 1) + num_shares, total_leased_used_space = l.get_total_leased_sharecount_and_used_space() + num_sharesets = l.get_number_of_sharesets() + self.failUnlessEqual(total_leased_used_space, 24690) + self.failUnlessEqual(num_shares, 2) + self.failUnlessEqual(num_sharesets, 1) + + l.add_new_share('si2', 0, 12345, SHARETYPE_IMMUTABLE) + l.add_starter_lease('si2', 0) + num_sharesets = l.get_number_of_sharesets() + num_shares, total_leased_used_space = l.get_total_leased_sharecount_and_used_space() + num_sharesets = l.get_number_of_sharesets() + self.failUnlessEqual(total_leased_used_space, 37035) + self.failUnlessEqual(num_shares, 3) + self.failUnlessEqual(num_sharesets, 2) + class MockCursor: def __init__(self): self.closed = False