FakeComponent was missing __lt__ comparison operator and couldnt be put in set()

This commit is contained in:
Lex Berezhny 2018-08-04 21:04:08 -04:00 committed by Jack Robison
parent d10778430f
commit 0dd6193eaa
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
3 changed files with 8 additions and 9 deletions

View file

@ -221,7 +221,7 @@ class Daemon(AuthJSONRPCServer):
# TODO: delete these, get the components where needed
self.storage = None
self.dht_node = None
#self.wallet = None
self.wallet = None
self.sd_identifier = None
self.file_manager = None
self.exchange_rate_manager = None
@ -237,10 +237,6 @@ class Daemon(AuthJSONRPCServer):
def ledger(self):
return self.wallet.default_account.ledger
@property
def wallet(self):
return self.session.wallet
@defer.inlineCallbacks
def setup(self):
log.info("Starting lbrynet-daemon")

View file

@ -400,6 +400,9 @@ class FakeComponent(object):
self._running = False
defer.returnValue(result)
def __lt__(self, other):
return self.component_name < other.component_name
class FakeDelayedWallet(FakeComponent):
component_name = "wallet"

View file

@ -50,8 +50,8 @@ def get_test_daemon(data_rate=None, generous=True, with_fee=False):
)
daemon = LBRYDaemon(component_manager=component_manager)
daemon.payment_rate_manager = OnlyFreePaymentsManager()
daemon.wallet = mock.Mock(spec=Wallet.LBRYumWallet)
daemon.wallet.wallet = mock.Mock(spec=NewWallet)
daemon.wallet = mock.Mock(spec=LbryWalletManager)
daemon.wallet.wallet = mock.Mock(spec=Wallet)
daemon.wallet.wallet.use_encryption = False
daemon.wallet.network = FakeNetwork()
daemon.storage = mock.Mock(spec=SQLiteStorage)
@ -106,7 +106,7 @@ class TestCostEst(unittest.TestCase):
correct_result = size / 10 ** 6 * data_rate + fake_fee_amount
daemon = get_test_daemon(generous=False, with_fee=True)
result = yield daemon.get_est_cost("test", size)
self.assertEqual(result, correct_result)
self.assertEqual(result, round(correct_result, 1))
@defer.inlineCallbacks
def test_generous_data_and_no_fee(self):
@ -123,7 +123,7 @@ class TestCostEst(unittest.TestCase):
correct_result = size / 10 ** 6 * data_rate
daemon = get_test_daemon(generous=False)
result = yield daemon.get_est_cost("test", size)
self.assertEqual(result, correct_result)
self.assertEqual(result, round(correct_result, 1))
class TestJsonRpc(unittest.TestCase):