Added unit tests for BTC, tBTC & LTC address generation

This commit is contained in:
slush0 2013-09-13 05:27:21 +02:00
parent c514fe3edd
commit d273cdf86b

View File

@ -1,28 +1,32 @@
import unittest
import common
# FIXME: This test implements Electrum algorithm only
class TestAddresses(common.TrezorTest):
def test_btc(self):
self.client.load_device(seed=self.mnemonic1, pin='')
self.client.apply_settings(coin_shortcut='BTC')
class TestAddresses(common.BitkeyTest):
def test_address(self):
self.bitkey.load_device(
seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
pin='')
self.assertEqual(self.client.get_address([]), '1GBDQapuquKZGPxWTB39s5bayLDTv5sD77')
self.assertEqual(self.client.get_address([1]), '13HWRT9JtftSF6uv65eMrQowHn3CioKegP')
self.assertEqual(self.client.get_address([0, 1]), '1GnnT11aZeH6QZCtT7EjCvRF3EXHoY3owE')
self.assertEqual(self.client.get_address([9, 0]), '1KeRRK74ARTxnby8dYsm2UreAx5tBGbbY7')
self.assertEqual(self.client.get_address([0, 9999999]), '1JeDAdRMxeuWCQ8ohWySCD5KEPoN2sEanK')
self.assertEqual(self.bitkey.get_address([0, 0]), "1KqYyzL53R8oA1LdYvyv7m6JUryFfGJDpa")
self.assertEqual(self.bitkey.get_address([2, 0]), "13MzKU6YjjdyiW3dZJDa5VU4AWGczQsdYD")
self.assertEqual(self.bitkey.get_address([3, 0]), "1FQVPnjrbkPWeA8poUoEnX9U3n9DyhAVtv")
self.assertEqual(self.bitkey.get_address([9, 0]), "1C9DHmWBpvGcFKXEiWWC3EK3EY5Bj79nze")
def test_ltc(self):
self.client.load_device(seed=self.mnemonic1, pin='')
self.client.apply_settings(coin_shortcut='LTC')
def test_change_address(self):
self.bitkey.load_device(
seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
pin='')
self.assertEqual(self.client.get_address([]), 'LaQAfo8jvZZcXCefdK2T96fMBYak5XomhR')
self.assertEqual(self.client.get_address([1]), 'LMWTgfT8yL8VVuc5GDdf8RshVzQUw9AoUK')
self.assertEqual(self.client.get_address([0, 1]), 'Lb1jiDKQeJX9fMu3dFE2UwV1FStZwvijfE')
self.assertEqual(self.client.get_address([9, 0]), 'LdsNgXQtF5i23QfHogs4JVvQPATAFbfWYA')
self.assertEqual(self.client.get_address([0, 9999999]), 'LcsARqjC3K9ZTCpxsexjUE95ScAeEPqR69')
self.assertEqual(self.bitkey.get_address([0, 1]), "17GpAFnkHRjWKePkX4kxHaHy49V8EHTr7i")
self.assertEqual(self.bitkey.get_address([2, 1]), "1MVgq4XaMX7PmohkYzFEisH1D7uxTiPbFK")
self.assertEqual(self.bitkey.get_address([3, 1]), "1M5NSqrUmmkZqokpHsJd5xm74YG6kjVcz4")
self.assertEqual(self.bitkey.get_address([9, 1]), "1BXUkUsc5gGSzYUAEebg5WZWtRGPNW4NQ9")
def test_tbtc(self):
self.client.load_device(seed=self.mnemonic1, pin='')
self.client.apply_settings(coin_shortcut='tBTC')
self.assertEqual(self.client.get_address([111, 42]), 'mypL2oDrCj4196uuvtC6QJnsetu3YMUdB7')
if __name__ == '__main__':
unittest.main()