X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/60b06883b6d5a336ef47c01103ec1ce25aafae69..cc49ae50f55e14465c700350157478f79fd13d33:/apps/catalogue/tests/bookmedia.py?ds=inline diff --git a/apps/catalogue/tests/bookmedia.py b/apps/catalogue/tests/bookmedia.py index 9ddd6aaa0..5f7970e84 100644 --- a/apps/catalogue/tests/bookmedia.py +++ b/apps/catalogue/tests/bookmedia.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -from os.path import basename +from os.path import basename, exists, join, dirname from django.core.files.base import ContentFile from catalogue.test_utils import * -from catalogue import models +from catalogue import models, utils class BookMediaTests(WLTestCase): @@ -84,3 +84,16 @@ class BookMediaTests(WLTestCase): self.assertNotEqual(basename(bm2.file.name), 'title.ogg') self.assertEqual(bm.file.read(), 'X') self.assertEqual(bm2.file.read(), 'Y') + + def test_zip_audiobooks(self): + paths = [ + join(dirname(__file__), "files/fraszka-do-anusie.xml"), + join(dirname(__file__), "files/fraszki.xml") + ] + + url = utils.create_zip(paths, 'test-zip-slug') + self.assertEqual("zip/test-zip-slug.zip", url) + self.assertTrue(exists(join(settings.MEDIA_ROOT, url))) + + utils.remove_zip('test-zip-slug') + self.assertFalse(exists(join(settings.MEDIA_ROOT, url)))