lbry-sdk/lbry/tests/unit/wallet/test_mnemonic.py
2020-01-01 15:57:56 -05:00

23 lines
723 B
Python

import unittest
from binascii import hexlify
from torba.client.mnemonic import Mnemonic
class TestMnemonic(unittest.TestCase):
def test_mnemonic_to_seed(self):
seed = Mnemonic.mnemonic_to_seed(mnemonic='foobar', passphrase='torba')
self.assertEqual(
hexlify(seed),
b'475a419db4e991cab14f08bde2d357e52b3e7241f72c6d8a2f92782367feeee9f403dc6a37c26a3f02ab9'
b'dec7f5063161eb139cea00da64cd77fba2f07c49ddc'
)
def test_make_seed_decode_encode(self):
iters = 10
m = Mnemonic('en')
for _ in range(iters):
seed = m.make_seed()
i = m.mnemonic_decode(seed)
self.assertEqual(m.mnemonic_encode(i), seed)