From 01de51b061c52f23c719324464251d8f267cf896 Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Wed, 3 Aug 2022 14:31:31 -0400 Subject: [PATCH] Update tests to account for multi_get feature and new DBStatePrefixRow fields. --- tests/test_revertable.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_revertable.py b/tests/test_revertable.py index d6b0dce..fa62f4d 100644 --- a/tests/test_revertable.py +++ b/tests/test_revertable.py @@ -7,8 +7,11 @@ from hub.db.prefixes import ClaimToTXOPrefixRow, PrefixDB class TestRevertableOpStack(unittest.TestCase): def setUp(self): - self.fake_db = {} - self.stack = RevertableOpStack(self.fake_db.get) + class FakeDB(dict): + def multi_get(keys): + return map(self.get, keys) + self.fake_db = FakeDB() + self.stack = RevertableOpStack(self.fake_db.get, self.fake_db.multi_get) def tearDown(self) -> None: self.stack.clear() @@ -167,7 +170,7 @@ class TestRevertablePrefixDB(unittest.TestCase): self.db.claim_expiration.stage_put((overflow_value, 1004, 0), (claim_hash3, name)) self.db.tx_num.stage_put((b'\x00' * 32,), (101,)) self.db.claim_takeover.stage_put((name,), (claim_hash3, 101)) - self.db.db_state.stage_put((), (b'n?\xcf\x12\x99\xd4\xec]y\xc3\xa4\xc9\x1dbJJ\xcf\x9e.\x17=\x95\xa1\xa0POgvihuV', 0, 1, b'VuhivgOP\xa0\xa1\x95=\x17.\x9e\xcfJJb\x1d\xc9\xa4\xc3y]\xec\xd4\x99\x12\xcf?n', 1, 0, 1, 7, 1, -1, -1, 0)) + self.db.db_state.stage_put((), (b'n?\xcf\x12\x99\xd4\xec]y\xc3\xa4\xc9\x1dbJJ\xcf\x9e.\x17=\x95\xa1\xa0POgvihuV', 0, 1, b'VuhivgOP\xa0\xa1\x95=\x17.\x9e\xcfJJb\x1d\xc9\xa4\xc3y]\xec\xd4\x99\x12\xcf?n', 1, 0, 1, 7, 1, -1, -1, 0, 0, 0)) self.db.unsafe_commit() state = self.db.db_state.get()