Projet

Général

Profil

0001-python3-handle-basic-authz-header-encoding-in-tests-.patch

Paul Marillonnet, 02 avril 2019 11:19

Télécharger (963 octets)

Voir les différences:

Subject: [PATCH] python3: handle basic authz header encoding in tests (#31175)

 tests/utils.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tests/utils.py
55 55

  
56 56

  
57 57
def basic_authorization_header(user, password=None):
58
    cred = base64.b64encode('%s:%s' % (user.username, password or user.username))
59
    return {'Authorization': 'Basic %s' % cred}
58
    cred = '%s:%s' % (user.username, password or user.username)
59
    b64cred = base64.b64encode(cred.encode('utf-8'))
60
    if six.PY3:
61
        b64cred = b64cred.decode('ascii')
62
    return {'Authorization': 'Basic %s' % b64cred}
60 63

  
61 64

  
62 65
def get_response_form(response, form='form'):
63
-