Projet

Général

Profil

0001-spplus-handle-secret-key-as-string-46432.patch

Serghei Mihai (congés, retour 15/05), 09 septembre 2020 12:19

Télécharger (1,36 ko)

Voir les différences:

Subject: [PATCH] spplus: handle secret key as string (#46432)

 eopayment/spplus.py  | 2 +-
 tests/test_spplus.py | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
eopayment/spplus.py
75 75

  
76 76

  
77 77
def decrypt_ntkey(ntkey):
78
    key = binascii.unhexlify(ntkey.replace(b' ', b''))
78
    key = binascii.unhexlify(force_byte(ntkey).replace(b' ', b''))
79 79
    return decrypt_key(key)
80 80

  
81 81

  
tests/test_spplus.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17
import eopayment.spplus as spplus
18
from eopayment import ResponseError
18
from eopayment import ResponseError, force_text
19 19

  
20 20
import pytest
21 21

  
......
41 41

  
42 42
    with pytest.raises(ResponseError, match=r'missing reference, etat or refsfp'):
43 43
        payment.response('foo=bar')
44

  
45
    # make sure key string and bytes representations are understood
46
    spplus.decrypt_ntkey(force_text(ntkey))
47
    spplus.decrypt_ntkey(ntkey)
44
-