mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-28 17:18:29 +00:00
core/tests: don't use coins.by_shortcut
This commit is contained in:
parent
94a8dc8e9d
commit
b31092a874
@ -15,14 +15,11 @@ class TestCoins(unittest.TestCase):
|
|||||||
('TAZ', 'Zcash Testnet', 7461),
|
('TAZ', 'Zcash Testnet', 7461),
|
||||||
]
|
]
|
||||||
for s, n, a in ref:
|
for s, n, a in ref:
|
||||||
c1 = coins.by_shortcut(s)
|
c = coins.by_name(n)
|
||||||
c2 = coins.by_name(n)
|
self.assertEqual(c.address_type, a)
|
||||||
self.assertEqual(c1, c2)
|
self.assertEqual(c.coin_shortcut, s)
|
||||||
self.assertEqual(c1.address_type, a)
|
|
||||||
|
|
||||||
def test_failure(self):
|
def test_failure(self):
|
||||||
with self.assertRaises(ValueError):
|
|
||||||
coins.by_shortcut('XXX')
|
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
coins.by_name('XXXXX')
|
coins.by_name('XXXXX')
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ class TestAddress(unittest.TestCase):
|
|||||||
([84 | HARDENED, 0 | HARDENED, 5 | HARDENED, 0, 10], InputScriptType.SPENDWITNESS),
|
([84 | HARDENED, 0 | HARDENED, 5 | HARDENED, 0, 10], InputScriptType.SPENDWITNESS),
|
||||||
([48 | HARDENED, 0 | HARDENED, 5 | HARDENED, 0, 10], InputScriptType.SPENDMULTISIG),
|
([48 | HARDENED, 0 | HARDENED, 5 | HARDENED, 0, 10], InputScriptType.SPENDMULTISIG),
|
||||||
]
|
]
|
||||||
coin = coins.by_shortcut('BTC')
|
coin = coins.by_name('Bitcoin')
|
||||||
for path, input_type in incorrect_derivation_paths:
|
for path, input_type in incorrect_derivation_paths:
|
||||||
self.assertFalse(validate_full_path(path, coin, input_type))
|
self.assertFalse(validate_full_path(path, coin, input_type))
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ class TestAddress(unittest.TestCase):
|
|||||||
([48 | HARDENED, 145 | HARDENED, 5 | HARDENED, 0, 0], InputScriptType.SPENDMULTISIG),
|
([48 | HARDENED, 145 | HARDENED, 5 | HARDENED, 0, 0], InputScriptType.SPENDMULTISIG),
|
||||||
([48 | HARDENED, 145 | HARDENED, 5 | HARDENED, 0, 10], InputScriptType.SPENDMULTISIG),
|
([48 | HARDENED, 145 | HARDENED, 5 | HARDENED, 0, 10], InputScriptType.SPENDMULTISIG),
|
||||||
]
|
]
|
||||||
coin = coins.by_shortcut('BCH') # segwit is disabled
|
coin = coins.by_name('Bcash') # segwit is disabled
|
||||||
for path, input_type in incorrect_derivation_paths:
|
for path, input_type in incorrect_derivation_paths:
|
||||||
self.assertFalse(validate_full_path(path, coin, input_type))
|
self.assertFalse(validate_full_path(path, coin, input_type))
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ class TestAddress(unittest.TestCase):
|
|||||||
([44 | HARDENED, 3 | HARDENED, 0 | HARDENED, 0, 1123], InputScriptType.SPENDADDRESS),
|
([44 | HARDENED, 3 | HARDENED, 0 | HARDENED, 0, 1123], InputScriptType.SPENDADDRESS),
|
||||||
([44 | HARDENED, 3 | HARDENED, 0 | HARDENED, 1, 44444], InputScriptType.SPENDADDRESS),
|
([44 | HARDENED, 3 | HARDENED, 0 | HARDENED, 1, 44444], InputScriptType.SPENDADDRESS),
|
||||||
]
|
]
|
||||||
coin = coins.by_shortcut('DOGE') # segwit is disabled
|
coin = coins.by_name('Dogecoin') # segwit is disabled
|
||||||
for path, input_type in correct_derivation_paths:
|
for path, input_type in correct_derivation_paths:
|
||||||
self.assertTrue(validate_full_path(path, coin, input_type))
|
self.assertTrue(validate_full_path(path, coin, input_type))
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ class TestAddress(unittest.TestCase):
|
|||||||
[84 | HARDENED, 0 | HARDENED, 5 | HARDENED, 0, 0],
|
[84 | HARDENED, 0 | HARDENED, 5 | HARDENED, 0, 0],
|
||||||
[84 | HARDENED, 0 | HARDENED, 5 | HARDENED, 0, 10],
|
[84 | HARDENED, 0 | HARDENED, 5 | HARDENED, 0, 10],
|
||||||
]
|
]
|
||||||
coin = coins.by_shortcut('BTC')
|
coin = coins.by_name('Bitcoin')
|
||||||
for path in correct_derivation_paths:
|
for path in correct_derivation_paths:
|
||||||
self.assertTrue(validate_path_for_bitcoin_public_key(path, coin))
|
self.assertTrue(validate_path_for_bitcoin_public_key(path, coin))
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ class TestAddress(unittest.TestCase):
|
|||||||
[44 | HARDENED, 3 | HARDENED, 0 | HARDENED, 0],
|
[44 | HARDENED, 3 | HARDENED, 0 | HARDENED, 0],
|
||||||
[44 | HARDENED, 3 | HARDENED, 0 | HARDENED, 0, 0],
|
[44 | HARDENED, 3 | HARDENED, 0 | HARDENED, 0, 0],
|
||||||
]
|
]
|
||||||
coin = coins.by_shortcut('DOGE') # segwit is disabled
|
coin = coins.by_name('Dogecoin') # segwit is disabled
|
||||||
for path in correct_derivation_paths:
|
for path in correct_derivation_paths:
|
||||||
self.assertTrue(validate_path_for_bitcoin_public_key(path, coin))
|
self.assertTrue(validate_path_for_bitcoin_public_key(path, coin))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user