Tested the test client uploading of NamedTemporaryFile.
This commit is contained in:
parent
5549e89b84
commit
e7dfb60353
|
@ -721,6 +721,11 @@ class ClientTest(TestCase):
|
||||||
response = self.client.post('/upload_view/', data={'temp_file': test_file})
|
response = self.client.post('/upload_view/', data={'temp_file': test_file})
|
||||||
self.assertEqual(response.content, b'temp_file')
|
self.assertEqual(response.content, b'temp_file')
|
||||||
|
|
||||||
|
def test_uploading_named_temp_file(self):
|
||||||
|
test_file = tempfile.NamedTemporaryFile()
|
||||||
|
response = self.client.post('/upload_view/', data={'named_temp_file': test_file})
|
||||||
|
self.assertEqual(response.content, b'named_temp_file')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(
|
@override_settings(
|
||||||
MIDDLEWARE=['django.middleware.csrf.CsrfViewMiddleware'],
|
MIDDLEWARE=['django.middleware.csrf.CsrfViewMiddleware'],
|
||||||
|
|
Loading…
Reference in New Issue