mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-08-30 17:01:28 +00:00
fixing tests
This commit is contained in:
parent
95a22831aa
commit
e7dcd9216b
2 changed files with 15 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
||||||
from binascii import unhexlify
|
from binascii import unhexlify
|
||||||
from twisted.trial import unittest
|
from twisted.trial import unittest
|
||||||
from torba.bip32 import PubKey, PrivateKey, from_extended_key_string
|
from torba.bip32 import PubKey, PrivateKey, from_extended_key_string
|
||||||
from torba.coin.bitcoinsegwit import MainNetLedger
|
from torba.coin.bitcoinsegwit import MainNetLedger as ledger_class
|
||||||
|
|
||||||
|
|
||||||
class BIP32Tests(unittest.TestCase):
|
class BIP32Tests(unittest.TestCase):
|
||||||
|
@ -40,7 +40,10 @@ class BIP32Tests(unittest.TestCase):
|
||||||
with self.assertRaisesRegex(ValueError, 'private key must be 32 bytes'):
|
with self.assertRaisesRegex(ValueError, 'private key must be 32 bytes'):
|
||||||
PrivateKey(None, b'abcd', b'abcd'*8, 0, 255)
|
PrivateKey(None, b'abcd', b'abcd'*8, 0, 255)
|
||||||
private_key = PrivateKey(
|
private_key = PrivateKey(
|
||||||
MainNetLedger({'db': True}),
|
ledger_class({
|
||||||
|
'db': ledger_class.database_class(':memory:'),
|
||||||
|
'headers': ledger_class.headers_class(':memory:'),
|
||||||
|
}),
|
||||||
unhexlify('2423f3dc6087d9683f73a684935abc0ccd8bc26370588f56653128c6a6f0bf7c'),
|
unhexlify('2423f3dc6087d9683f73a684935abc0ccd8bc26370588f56653128c6a6f0bf7c'),
|
||||||
b'abcd'*8, 0, 1
|
b'abcd'*8, 0, 1
|
||||||
)
|
)
|
||||||
|
@ -57,7 +60,10 @@ class BIP32Tests(unittest.TestCase):
|
||||||
self.assertIsInstance(private_key.child(PrivateKey.HARDENED), PrivateKey)
|
self.assertIsInstance(private_key.child(PrivateKey.HARDENED), PrivateKey)
|
||||||
|
|
||||||
def test_from_extended_keys(self):
|
def test_from_extended_keys(self):
|
||||||
ledger = MainNetLedger({'db': True})
|
ledger = ledger_class({
|
||||||
|
'db': ledger_class.database_class(':memory:'),
|
||||||
|
'headers': ledger_class.headers_class(':memory:'),
|
||||||
|
})
|
||||||
self.assertIsInstance(
|
self.assertIsInstance(
|
||||||
from_extended_key_string(
|
from_extended_key_string(
|
||||||
ledger,
|
ledger,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from twisted.trial import unittest
|
from twisted.trial import unittest
|
||||||
from types import GeneratorType
|
from types import GeneratorType
|
||||||
|
|
||||||
from torba.coin.bitcoinsegwit import MainNetLedger
|
from torba.coin.bitcoinsegwit import MainNetLedger as ledger_class
|
||||||
from torba.coinselection import CoinSelector, MAXIMUM_TRIES
|
from torba.coinselection import CoinSelector, MAXIMUM_TRIES
|
||||||
from torba.constants import CENT
|
from torba.constants import CENT
|
||||||
|
|
||||||
|
@ -19,8 +19,11 @@ def search(*args, **kwargs):
|
||||||
class BaseSelectionTestCase(unittest.TestCase):
|
class BaseSelectionTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.ledger = MainNetLedger({'db': MainNetLedger.database_class(':memory:')})
|
self.ledger = ledger_class({
|
||||||
return self.ledger.db.start()
|
'db': ledger_class.database_class(':memory:'),
|
||||||
|
'headers': ledger_class.headers_class(':memory:'),
|
||||||
|
})
|
||||||
|
return self.ledger.db.open()
|
||||||
|
|
||||||
def estimates(self, *args):
|
def estimates(self, *args):
|
||||||
txos = args[0] if isinstance(args[0], (GeneratorType, list)) else args
|
txos = args[0] if isinstance(args[0], (GeneratorType, list)) else args
|
||||||
|
|
Loading…
Add table
Reference in a new issue