spplus: handle secret key as string (#46432)

This commit is contained in:
Serghei Mihai 2020-09-07 18:12:25 +02:00
parent 1ee8871eda
commit 5991c69c4e
2 changed files with 6 additions and 2 deletions

View File

@ -75,7 +75,7 @@ TEST_STATE = ('99',)
def decrypt_ntkey(ntkey):
key = binascii.unhexlify(ntkey.replace(b' ', b''))
key = binascii.unhexlify(force_byte(ntkey).replace(b' ', b''))
return decrypt_key(key)

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import eopayment.spplus as spplus
from eopayment import ResponseError
from eopayment import ResponseError, force_text
import pytest
@ -41,3 +41,7 @@ def test_spplus():
with pytest.raises(ResponseError, match=r'missing reference, etat or refsfp'):
payment.response('foo=bar')
# make sure key string and bytes representations are understood
spplus.decrypt_ntkey(force_text(ntkey))
spplus.decrypt_ntkey(ntkey)