1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

test_addresses.py passed (although it uses Electrum algo, not BIP32)

This commit is contained in:
slush 2013-09-01 03:38:03 +02:00
parent 702460d153
commit 3e39a4c267

View File

@ -1,40 +1,28 @@
import unittest import unittest
import common import common
import bitkeylib.bitkey_pb2 as proto # FIXME: This test implements Electrum algorithm only
class TestAddresses(common.BitkeyTest): class TestAddresses(common.BitkeyTest):
def test_electrum_address(self): def test_address(self):
self.bitkey.load_device(algo=proto.ELECTRUM, self.bitkey.load_device(
seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice', seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
otp=False, pin='', spv=False) pin='')
self.bitkey.algo = proto.ELECTRUM
self.assertEqual(self.bitkey.get_address([0, 0]), "1KqYyzL53R8oA1LdYvyv7m6JUryFfGJDpa") self.assertEqual(self.bitkey.get_address([0, 0]), "1KqYyzL53R8oA1LdYvyv7m6JUryFfGJDpa")
self.assertEqual(self.bitkey.get_address([2, 0]), "13MzKU6YjjdyiW3dZJDa5VU4AWGczQsdYD") self.assertEqual(self.bitkey.get_address([2, 0]), "13MzKU6YjjdyiW3dZJDa5VU4AWGczQsdYD")
self.assertEqual(self.bitkey.get_address([3, 0]), "1FQVPnjrbkPWeA8poUoEnX9U3n9DyhAVtv") self.assertEqual(self.bitkey.get_address([3, 0]), "1FQVPnjrbkPWeA8poUoEnX9U3n9DyhAVtv")
self.assertEqual(self.bitkey.get_address([9, 0]), "1C9DHmWBpvGcFKXEiWWC3EK3EY5Bj79nze") self.assertEqual(self.bitkey.get_address([9, 0]), "1C9DHmWBpvGcFKXEiWWC3EK3EY5Bj79nze")
def test_electrum_change_address(self): def test_change_address(self):
self.bitkey.load_device(algo=proto.ELECTRUM, self.bitkey.load_device(
seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice', seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
otp=False, pin='', spv=False) pin='')
self.bitkey.algo = proto.ELECTRUM
self.assertEqual(self.bitkey.get_address([0, 1]), "17GpAFnkHRjWKePkX4kxHaHy49V8EHTr7i") self.assertEqual(self.bitkey.get_address([0, 1]), "17GpAFnkHRjWKePkX4kxHaHy49V8EHTr7i")
self.assertEqual(self.bitkey.get_address([2, 1]), "1MVgq4XaMX7PmohkYzFEisH1D7uxTiPbFK") self.assertEqual(self.bitkey.get_address([2, 1]), "1MVgq4XaMX7PmohkYzFEisH1D7uxTiPbFK")
self.assertEqual(self.bitkey.get_address([3, 1]), "1M5NSqrUmmkZqokpHsJd5xm74YG6kjVcz4") self.assertEqual(self.bitkey.get_address([3, 1]), "1M5NSqrUmmkZqokpHsJd5xm74YG6kjVcz4")
self.assertEqual(self.bitkey.get_address([9, 1]), "1BXUkUsc5gGSzYUAEebg5WZWtRGPNW4NQ9") self.assertEqual(self.bitkey.get_address([9, 1]), "1BXUkUsc5gGSzYUAEebg5WZWtRGPNW4NQ9")
'''
def test_bip32_address(self):
# TODO, FIXME
self.bitkey.load_device(seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
otp=False, pin='', spv=False)
self.bitkey.algo = proto.BIP32
#self.assertEqual(self.bitkey.get_address([0, 0]), "1KqYyzL53R8oA1LdYvyv7m6JUryFfGJDpa")
'''
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()