test_blindsig: use bytes() on bytearray() everywhere, not str()

This commit is contained in:
Dmitri Bogomolov 2021-07-28 01:14:02 +03:00
parent f9c49fbeb3
commit a757c26d09
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -4,9 +4,6 @@ Test for ECC blind signatures
import os import os
import unittest import unittest
from hashlib import sha256 from hashlib import sha256
from .common import skip_python3
skip_python3()
from pybitmessage.pyelliptic import ECCBlind, ECCBlindChain, OpenSSL from pybitmessage.pyelliptic import ECCBlind, ECCBlindChain, OpenSSL
@ -200,7 +197,7 @@ class TestBlindSig(unittest.TestCase):
output.extend(pubkey) output.extend(pubkey)
output.extend(signature) output.extend(signature)
signer_obj = child_obj signer_obj = child_obj
verifychain = ECCBlindChain(ca=ca.pubkey(), chain=str(output)) verifychain = ECCBlindChain(ca=ca.pubkey(), chain=bytes(output))
self.assertFalse(verifychain.verify(msg, 1)) self.assertFalse(verifychain.verify(msg, 1))
def test_blind_sig_chain_wrong_msg(self): # pylint: disable=too-many-locals def test_blind_sig_chain_wrong_msg(self): # pylint: disable=too-many-locals
@ -235,7 +232,7 @@ class TestBlindSig(unittest.TestCase):
output.extend(pubkey) output.extend(pubkey)
output.extend(signature) output.extend(signature)
signer_obj = child_obj signer_obj = child_obj
verifychain = ECCBlindChain(ca=ca.pubkey(), chain=str(output)) verifychain = ECCBlindChain(ca=ca.pubkey(), chain=bytes(output))
self.assertFalse(verifychain.verify(fake_msg, 1)) self.assertFalse(verifychain.verify(fake_msg, 1))
def test_blind_sig_chain_wrong_intermediary(self): # pylint: disable=too-many-locals def test_blind_sig_chain_wrong_intermediary(self): # pylint: disable=too-many-locals
@ -273,5 +270,5 @@ class TestBlindSig(unittest.TestCase):
output.extend(pubkey) output.extend(pubkey)
output.extend(signature) output.extend(signature)
signer_obj = child_obj signer_obj = child_obj
verifychain = ECCBlindChain(ca=ca.pubkey(), chain=str(output)) verifychain = ECCBlindChain(ca=ca.pubkey(), chain=bytes(output))
self.assertFalse(verifychain.verify(msg, 1)) self.assertFalse(verifychain.verify(msg, 1))