Skip to content

Commit beb8260

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

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
from .samples import (
88
sample_address, sample_ripe,
@@ -40,9 +40,21 @@ def test_wif(self):
4040
"""Decode WIFs of [chan] bitmessage and check the keys"""
4141
self.assertEqual(
4242
sample_wif_privsigningkey,
43-
shared.decodeWalletImportFormat(
43+
highlevelcrypto.decodeWalletImportFormat(
4444
b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm'))
4545
self.assertEqual(
4646
sample_wif_privencryptionkey,
47-
shared.decodeWalletImportFormat(
47+
highlevelcrypto.decodeWalletImportFormat(
4848
b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHqpA'))
49+
self.assertEqual(
50+
b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm',
51+
highlevelcrypto.encodeWalletImportFormat(
52+
sample_wif_privsigningkey))
53+
self.assertEqual(
54+
b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHqpA',
55+
highlevelcrypto.encodeWalletImportFormat(
56+
sample_wif_privencryptionkey))
57+
58+
with self.assertRaises(ValueError):
59+
highlevelcrypto.decodeWalletImportFormat(
60+
b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHq')

0 commit comments

Comments
 (0)