1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-28 00:58:09 +00:00

core/tests: don't use coins.by_shortcut

This commit is contained in:
Pavol Rusnak 2019-05-22 16:46:49 +02:00
parent 94a8dc8e9d
commit b31092a874
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 8 additions and 11 deletions

View File

@ -15,14 +15,11 @@ class TestCoins(unittest.TestCase):
('TAZ', 'Zcash Testnet', 7461),
]
for s, n, a in ref:
c1 = coins.by_shortcut(s)
c2 = coins.by_name(n)
self.assertEqual(c1, c2)
self.assertEqual(c1.address_type, a)
c = coins.by_name(n)
self.assertEqual(c.address_type, a)
self.assertEqual(c.coin_shortcut, s)
def test_failure(self):
with self.assertRaises(ValueError):
coins.by_shortcut('XXX')
with self.assertRaises(ValueError):
coins.by_name('XXXXX')

View File

@ -154,7 +154,7 @@ class TestAddress(unittest.TestCase):
([84 | HARDENED, 0 | HARDENED, 5 | HARDENED, 0, 10], InputScriptType.SPENDWITNESS),
([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:
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, 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:
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, 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:
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, 10],
]
coin = coins.by_shortcut('BTC')
coin = coins.by_name('Bitcoin')
for path in correct_derivation_paths:
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, 0],
]
coin = coins.by_shortcut('DOGE') # segwit is disabled
coin = coins.by_name('Dogecoin') # segwit is disabled
for path in correct_derivation_paths:
self.assertTrue(validate_path_for_bitcoin_public_key(path, coin))