1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-30 03:18:20 +00:00
trezor-firmware/core/tests/test_apps.common.coins.py

40 lines
1.0 KiB
Python
Raw Normal View History

2016-11-15 10:57:18 +00:00
from common import *
from apps.common import coins
2017-12-16 01:11:26 +00:00
2016-11-15 10:57:18 +00:00
class TestCoins(unittest.TestCase):
def test_bitcoin(self):
2016-11-15 10:57:18 +00:00
ref = [
('BTC', 'Bitcoin', 0),
('TEST', 'Testnet', 111),
('REGTEST', 'Regtest', 111),
]
for s, n, a in ref:
c = coins.by_name(n)
self.assertEqual(c.address_type, a)
self.assertEqual(c.coin_shortcut, s)
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
def test_altcoins(self):
ref = [
2016-11-15 10:57:18 +00:00
('NMC', 'Namecoin', 52),
('LTC', 'Litecoin', 48),
('DASH', 'Dash', 76),
('ZEC', 'Zcash', 7352),
('TAZ', 'Zcash Testnet', 7461),
]
for s, n, a in ref:
c = coins.by_name(n)
self.assertEqual(c.address_type, a)
self.assertEqual(c.coin_shortcut, s)
2016-11-15 10:57:18 +00:00
def test_failure(self):
with self.assertRaises(ValueError):
coins.by_name('XXXXX')
if __name__ == '__main__':
unittest.main()