From 659b292357fc638905792f7c1d77a73e9630e49c Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Thu, 29 Jul 2021 21:37:01 +0300 Subject: [PATCH] test_wif(): import from highlevelcrypto and add encoding checks --- src/tests/test_addresses.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/tests/test_addresses.py b/src/tests/test_addresses.py index 43b4884f..4c4a33d6 100644 --- a/src/tests/test_addresses.py +++ b/src/tests/test_addresses.py @@ -2,7 +2,7 @@ import unittest from binascii import unhexlify -from pybitmessage import addresses, shared +from pybitmessage import addresses, highlevelcrypto from .samples import ( sample_address, sample_daddr3_512, sample_daddr4_512, @@ -65,9 +65,21 @@ class TestAddresses(unittest.TestCase): """Decode WIFs of [chan] bitmessage and check the keys""" self.assertEqual( sample_wif_privsigningkey, - shared.decodeWalletImportFormat( + highlevelcrypto.decodeWalletImportFormat( b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm')) self.assertEqual( sample_wif_privencryptionkey, - shared.decodeWalletImportFormat( + highlevelcrypto.decodeWalletImportFormat( b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHqpA')) + self.assertEqual( + b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm', + highlevelcrypto.encodeWalletImportFormat( + sample_wif_privsigningkey)) + self.assertEqual( + b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHqpA', + highlevelcrypto.encodeWalletImportFormat( + sample_wif_privencryptionkey)) + + with self.assertRaises(ValueError): + highlevelcrypto.decodeWalletImportFormat( + b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHq')