forked from LBRYCommunity/lbry-sdk
cleanup paths
This commit is contained in:
parent
eca69391ef
commit
94bf357817
1 changed files with 4 additions and 10 deletions
|
@ -1,10 +1,10 @@
|
||||||
import json
|
import json
|
||||||
import jsonschema
|
import jsonschema
|
||||||
import os
|
import os
|
||||||
import pathlib
|
|
||||||
import tempfile
|
import tempfile
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
|
|
||||||
|
import lbry.schema.types.v2 as schema_v2
|
||||||
from unittest import TestCase, mock
|
from unittest import TestCase, mock
|
||||||
from lbry.testcase import AsyncioTestCase
|
from lbry.testcase import AsyncioTestCase
|
||||||
from lbry.wallet import (
|
from lbry.wallet import (
|
||||||
|
@ -21,12 +21,6 @@ class TestWalletCreation(AsyncioTestCase):
|
||||||
self.main_ledger = self.manager.get_or_create_ledger(Ledger.get_id(), config)
|
self.main_ledger = self.manager.get_or_create_ledger(Ledger.get_id(), config)
|
||||||
self.test_ledger = self.manager.get_or_create_ledger(RegTestLedger.get_id(), config)
|
self.test_ledger = self.manager.get_or_create_ledger(RegTestLedger.get_id(), config)
|
||||||
|
|
||||||
base_dir = pathlib.Path(__file__).parents[3]
|
|
||||||
types_dir = base_dir.joinpath('lbry', 'schema', 'types', 'v2')
|
|
||||||
|
|
||||||
with types_dir.joinpath('wallet.json').open() as f:
|
|
||||||
self.wallet_schema = json.load(f)
|
|
||||||
|
|
||||||
def test_create_wallet_and_accounts(self):
|
def test_create_wallet_and_accounts(self):
|
||||||
wallet = Wallet()
|
wallet = Wallet()
|
||||||
self.assertEqual(wallet.name, 'Wallet')
|
self.assertEqual(wallet.name, 'Wallet')
|
||||||
|
@ -84,9 +78,7 @@ class TestWalletCreation(AsyncioTestCase):
|
||||||
decrypted = Wallet.unpack('password', encrypted)
|
decrypted = Wallet.unpack('password', encrypted)
|
||||||
self.assertEqual(decrypted['accounts'][0]['name'], 'An Account')
|
self.assertEqual(decrypted['accounts'][0]['name'], 'An Account')
|
||||||
|
|
||||||
|
|
||||||
def test_wallet_file_schema(self):
|
def test_wallet_file_schema(self):
|
||||||
# One Deterministic Chain, one Single Address, to test both paths in the schema.
|
|
||||||
wallet_dict = {
|
wallet_dict = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
'name': 'Main Wallet',
|
'name': 'Main Wallet',
|
||||||
|
@ -138,7 +130,9 @@ class TestWalletCreation(AsyncioTestCase):
|
||||||
storage = WalletStorage(default=wallet_dict)
|
storage = WalletStorage(default=wallet_dict)
|
||||||
wallet = Wallet.from_storage(storage, self.manager)
|
wallet = Wallet.from_storage(storage, self.manager)
|
||||||
self.assertDictEqual(wallet_dict, wallet.to_dict())
|
self.assertDictEqual(wallet_dict, wallet.to_dict())
|
||||||
jsonschema.validate(schema=self.wallet_schema, instance=wallet.to_dict())
|
with open(os.path.join(*schema_v2.__path__, 'wallet.json')) as f:
|
||||||
|
wallet_schema = json.load(f)
|
||||||
|
jsonschema.validate(schema=wallet_schema, instance=wallet.to_dict())
|
||||||
|
|
||||||
def test_no_password_but_encryption_preferred(self):
|
def test_no_password_but_encryption_preferred(self):
|
||||||
wallet_dict = {
|
wallet_dict = {
|
||||||
|
|
Loading…
Reference in a new issue