mirror of https://github.com/django/django.git
Fixed errors introduced in 664855b74e
This commit is contained in:
parent
5ae0c933a8
commit
f368c25f10
|
@ -2,7 +2,6 @@ from __future__ import absolute_import
|
||||||
|
|
||||||
import gzip
|
import gzip
|
||||||
import shutil
|
import shutil
|
||||||
import StringIO
|
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
|
@ -11,6 +10,7 @@ from django.core.files.base import ContentFile
|
||||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import unittest
|
from django.utils import unittest
|
||||||
|
from django.utils.six import StringIO
|
||||||
|
|
||||||
from .models import Storage, temp_storage, temp_storage_location
|
from .models import Storage, temp_storage, temp_storage_location
|
||||||
|
|
||||||
|
@ -115,12 +115,12 @@ class FileStorageTests(TestCase):
|
||||||
self.assertTrue(temp_storage.exists('tests/file_obj'))
|
self.assertTrue(temp_storage.exists('tests/file_obj'))
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
temp_storage.open('tests/file_obj').read(),
|
temp_storage.open('tests/file_obj').read(),
|
||||||
'some content')
|
b'some content')
|
||||||
|
|
||||||
|
|
||||||
def test_stringio(self):
|
def test_stringio(self):
|
||||||
# Test passing StringIO instance as content argument to save
|
# Test passing StringIO instance as content argument to save
|
||||||
output = StringIO.StringIO()
|
output = StringIO()
|
||||||
output.write('content')
|
output.write('content')
|
||||||
output.seek(0)
|
output.seek(0)
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ class FileStorageTests(TestCase):
|
||||||
self.assertTrue(temp_storage.exists('tests/stringio'))
|
self.assertTrue(temp_storage.exists('tests/stringio'))
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
temp_storage.open('tests/stringio').read(),
|
temp_storage.open('tests/stringio').read(),
|
||||||
'content')
|
b'content')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue