Projet

Général

Profil

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

Paul Marillonnet, 06 mars 2019 21:33

Télécharger (1,08 ko)

Voir les différences:

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

 tests/utils.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
tests/utils.py
1 1
import re
2 2
import base64
3 3
import urlparse
4
import six
4 5
from contextlib import contextmanager
5 6

  
6 7
from lxml import etree
......
53 54

  
54 55

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

  
58 63

  
59 64

  
60 65
def get_response_form(response, form='form'):
61
-