1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Replaced many smart_bytes by force_bytes

In all those occurrences, we didn't care about preserving the
lazy status of the strings, but we really wanted to obtain a
real bytestring.
This commit is contained in:
Claude Paroz
2012-08-28 20:59:56 +02:00
parent 9eafb6592e
commit ebc773ada3
32 changed files with 74 additions and 77 deletions

View File

@@ -12,7 +12,7 @@ from django.core.files import temp as tempfile
from django.core.files.uploadedfile import SimpleUploadedFile
from django.http.multipartparser import MultiPartParser
from django.test import TestCase, client
from django.utils.encoding import smart_bytes
from django.utils.encoding import force_bytes
from django.utils.six import StringIO
from django.utils import unittest
@@ -54,7 +54,7 @@ class FileUploadTests(TestCase):
post_data[key + '_hash'] = hashlib.sha1(post_data[key].read()).hexdigest()
post_data[key].seek(0)
except AttributeError:
post_data[key + '_hash'] = hashlib.sha1(smart_bytes(post_data[key])).hexdigest()
post_data[key + '_hash'] = hashlib.sha1(force_bytes(post_data[key])).hexdigest()
response = self.client.post('/file_uploads/verify/', post_data)
@@ -68,7 +68,7 @@ class FileUploadTests(TestCase):
'Content-Type: application/octet-stream',
'Content-Transfer-Encoding: base64',
'',
base64.b64encode(smart_bytes(test_string)).decode('ascii'),
base64.b64encode(force_bytes(test_string)).decode('ascii'),
'--' + client.BOUNDARY + '--',
'',
]).encode('utf-8')