unbreak tests

This commit is contained in:
Alex Grintsvayg 2017-02-21 13:47:47 -05:00
parent b6086a7d6d
commit 2add545ab6
2 changed files with 16 additions and 2 deletions

View file

@ -30,6 +30,16 @@ class Node(object):
pass pass
class FakeNetwork(object):
@staticmethod
def get_local_height():
return 1
@staticmethod
def get_server_height():
return 1
class Wallet(object): class Wallet(object):
def __init__(self): def __init__(self):
self.private_key = RSA.generate(1024) self.private_key = RSA.generate(1024)

View file

@ -10,7 +10,7 @@ from lbrynet.core import Session, PaymentRateManager, Wallet
from lbrynet.lbrynet_daemon.Daemon import Daemon as LBRYDaemon from lbrynet.lbrynet_daemon.Daemon import Daemon as LBRYDaemon
from lbrynet.lbrynet_daemon import ExchangeRateManager from lbrynet.lbrynet_daemon import ExchangeRateManager
from lbrynet import conf from lbrynet import conf
from tests.mocks import mock_conf_settings from tests.mocks import mock_conf_settings, FakeNetwork
class MiscTests(unittest.TestCase): class MiscTests(unittest.TestCase):
@ -117,11 +117,15 @@ class TestCostEst(unittest.TestCase):
class TestJsonRpc(unittest.TestCase): class TestJsonRpc(unittest.TestCase):
def setUp(self): def setUp(self):
def noop():
return None
mock_conf_settings(self) mock_conf_settings(self)
util.resetTime(self) util.resetTime(self)
self.test_daemon = get_test_daemon() self.test_daemon = get_test_daemon()
self.test_daemon.session.wallet = Wallet.LBRYumWallet(storage=Wallet.InMemoryStorage()) self.test_daemon.session.wallet = Wallet.LBRYumWallet(storage=Wallet.InMemoryStorage())
# self.test_daemon.session.wallet = FakeWallet() self.test_daemon.session.wallet.network = FakeNetwork()
self.test_daemon.session.wallet.get_best_blockhash = noop
def test_status(self): def test_status(self):
d = defer.maybeDeferred(self.test_daemon.jsonrpc_status) d = defer.maybeDeferred(self.test_daemon.jsonrpc_status)