Skip to content

Commit 51bb0f9

Browse files
committed
test TemporaryExcelFileUploadHandler
1 parent ecbe90f commit 51bb0f9

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

django_excel/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ def load_book(self):
2727

2828
class ExcelMemoryFileUploadHandler(MemoryFileUploadHandler):
2929
def file_complete(self, file_size):
30+
if not self.activated:
31+
return
3032
self.file.seek(0)
3133
return ExcelMemoryFile(
3234
file=self.file,

testResponse.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from unittest import TestCase
2-
from django.test import Client
1+
from django.test import Client, TestCase
2+
from django.test.utils import override_settings
33
import pyexcel as pe
44
import pyexcel.ext.xls
55
import pyexcel.ext.xlsx
@@ -109,4 +109,9 @@ def test_exchange(self):
109109
sheet.format(int)
110110
array = sheet.to_array()
111111
assert array == self.data
112-
os.unlink(tmp_filename)
112+
os.unlink(tmp_filename)
113+
114+
115+
@override_settings(FILE_UPLOAD_MAX_MEMORY_SIZE=1)
116+
class ExcelResponseUsingFileTestCase(ExcelResponseTestCase):
117+
pass

0 commit comments

Comments
 (0)