Skip to content

Commit 00bb768

Browse files
committed
test_wif(): enable python3 and add encoding checks
1 parent ad86ab1 commit 00bb768

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/tests/test_addresses.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11

2-
import sys
32
import unittest
43
from binascii import unhexlify
54

6-
from pybitmessage import addresses, shared
5+
from pybitmessage import addresses, highlevelcrypto
76

87

98
sample_ripe = unhexlify('003cd097eb7f35c87b5dc8b4538c22cb55312a9f')
@@ -42,15 +41,25 @@ def test_encode(self):
4241
self.assertEqual(
4342
addresses.encodeAddress(2, 1, sample_ripe), sample_address)
4443

45-
@unittest.skipIf(
46-
sys.hexversion >= 0x3000000, 'emergency exit on python3!')
4744
def test_wif(self):
4845
"""Decode WIFs of [chan] bitmessage and check the keys"""
4946
self.assertEqual(
5047
sample_wif_privsigningkey,
51-
shared.decodeWalletImportFormat(
48+
highlevelcrypto.decodeWalletImportFormat(
5249
b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm'))
5350
self.assertEqual(
5451
sample_wif_privencryptionkey,
55-
shared.decodeWalletImportFormat(
52+
highlevelcrypto.decodeWalletImportFormat(
5653
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)