0001-python3-basic-authz-header-encoding-in-tests-31175.patch
tests/utils.py | ||
---|---|---|
25 | 25 |
from django.test import TestCase |
26 | 26 |
from django.core.urlresolvers import reverse |
27 | 27 |
from django.conf import settings |
28 |
from django.utils.encoding import iri_to_uri |
|
28 |
from django.utils.encoding import iri_to_uri, force_text
|
|
29 | 29 |
from django.shortcuts import resolve_url |
30 | 30 |
from django.utils import six |
31 | 31 |
from django.utils.six.moves.urllib import parse as urlparse |
... | ... | |
72 | 72 | |
73 | 73 | |
74 | 74 |
def basic_authorization_header(user, password=None): |
75 |
cred = base64.b64encode('%s:%s' % (user.username, password or user.username)) |
|
76 |
return {'Authorization': 'Basic %s' % cred} |
|
75 |
cred = '%s:%s' % (user.username, password or user.username) |
|
76 |
b64_cred = base64.b64encode(cred.encode('utf-8')) |
|
77 |
return {'Authorization': 'Basic %s' % str(force_text(b64_cred))} |
|
77 | 78 | |
78 | 79 | |
79 | 80 |
def get_response_form(response, form='form'): |
80 |
- |