Ticket #19367: ticket19367.txt

File ticket19367.txt, 1.3 KB (added by void, 3 years ago)

Failing test

Line 
1diff --git a/tests/regressiontests/file_storage/tests.py b/tests/regressiontests/file_storage/tests.py
2index 595b65d..74b6237 100644
3--- a/tests/regressiontests/file_storage/tests.py
4+++ b/tests/regressiontests/file_storage/tests.py
5@@ -559,6 +559,9 @@ class InconsistentGetImageDimensionsBug(unittest.TestCase):
6         self.assertEqual(size_1, size_2)
7 
8 class ContentFileTestCase(unittest.TestCase):
9+    def setUp(self):
10+        self.storage_dir = tempfile.mkdtemp()
11+        self.storage = FileSystemStorage(self.storage_dir)
12 
13     def test_content_file_default_name(self):
14         self.assertEqual(ContentFile(b"content").name, None)
15@@ -577,6 +580,13 @@ class ContentFileTestCase(unittest.TestCase):
16         """
17         self.assertTrue(isinstance(ContentFile(b"content").read(), bytes))
18         self.assertTrue(isinstance(ContentFile("español").read(), six.text_type))
19+       
20+    def test_content_saving(self):
21+        """
22+        Test that ContentFile can be saved correctly with the filesystem storage,
23+        both if it was initialized with string or unicode content"""
24+        self.storage.save('bytes.txt', ContentFile(b"content"))
25+        self.storage.save('unicode.txt', ContentFile("español"))
26 
27 class NoNameFileTestCase(unittest.TestCase):
28     """
Back to Top