Skip to content

Commit fe85e60

Browse files
committed
test_wif(): import from highlevelcrypto and add encoding checks
1 parent c49c131 commit fe85e60

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/tests/test_addresses.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import unittest
33
from binascii import unhexlify
44

5-
from pybitmessage import addresses, shared
5+
from pybitmessage import addresses, highlevelcrypto
66

77

88
sample_ripe = unhexlify('003cd097eb7f35c87b5dc8b4538c22cb55312a9f')
@@ -45,9 +45,21 @@ def test_wif(self):
4545
"""Decode WIFs of [chan] bitmessage and check the keys"""
4646
self.assertEqual(
4747
sample_wif_privsigningkey,
48-
shared.decodeWalletImportFormat(
48+
highlevelcrypto.decodeWalletImportFormat(
4949
b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm'))
5050
self.assertEqual(
5151
sample_wif_privencryptionkey,
52-
shared.decodeWalletImportFormat(
52+
highlevelcrypto.decodeWalletImportFormat(
5353
b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHqpA'))
54+
self.assertEqual(
55+
b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm',
56+
highlevelcrypto.encodeWalletImportFormat(
57+
sample_wif_privsigningkey))
58+
self.assertEqual(
59+
b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHqpA',
60+
highlevelcrypto.encodeWalletImportFormat(
61+
sample_wif_privencryptionkey))
62+
63+
with self.assertRaises(ValueError):
64+
highlevelcrypto.decodeWalletImportFormat(
65+
b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHq')

0 commit comments

Comments
 (0)