0001-python3-basic-authz-header-encoding-in-tests-31175.patch
tests/utils.py | ||
---|---|---|
8 | 8 |
from django.test import TestCase |
9 | 9 |
from django.core.urlresolvers import reverse |
10 | 10 |
from django.conf import settings |
11 |
from django.utils.encoding import iri_to_uri |
|
11 |
from django.utils.encoding import iri_to_uri, force_text
|
|
12 | 12 |
from django.shortcuts import resolve_url |
13 | 13 |
from django.utils import six |
14 | 14 |
from django.utils.six.moves.urllib import parse as urlparse |
... | ... | |
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 |
b64_cred = base64.b64encode(cred.encode('ascii')) |
|
60 |
return {'Authorization': 'Basic %s' % str(force_text(b64_cred))} |
|
60 | 61 | |
61 | 62 | |
62 | 63 |
def get_response_form(response, form='form'): |
63 |
- |