X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/a39b207ad55440ed2b3edcedd765a3228f8001e3..1c5c96529bfa119cad5fef9bcaf260fae0bd305d:/apps/catalogue/tests/bookmedia.py diff --git a/apps/catalogue/tests/bookmedia.py b/apps/catalogue/tests/bookmedia.py index a9f76e941..72fb03067 100644 --- a/apps/catalogue/tests/bookmedia.py +++ b/apps/catalogue/tests/bookmedia.py @@ -7,11 +7,24 @@ from catalogue import models class BookMediaTests(WLTestCase): + def setUp(self): + WLTestCase.setUp(self) + self.file = ContentFile('X') + + def test_diacritics(self): + bm = models.BookMedia.objects.create(type="ogg", + name="Zażółć gęślą jaźń") + bm.file.save(bm.name, self.file) + self.assertEqual(bm.file.name.rsplit('/', 1)[-1], 'zazolc-gesla-jazn.ogg') + + def test_long_name(self): - file = ContentFile('X') bm = models.BookMedia.objects.create(type="ogg", name="Some very very very very very very very very very very very very very very very very long file name") - bm.file.save(bm.name, file) + + # save twice so Django adds some stuff + bm.file.save(bm.name, self.file) + bm.file.save(bm.name, self.file) bm.save() # reload to see what was really saved