diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-09-02 16:46:15 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-09-02 16:46:15 +0200 |
commit | 7520106958557d7bf9eab12ea2d3fce127f0dcff (patch) | |
tree | 0848d67ba250628706662102c1e9e26c598ae2cc /ishtar_common/tests.py | |
parent | 826174d9e21b7d8b9c963cf0bf118045c4867d49 (diff) | |
download | Ishtar-7520106958557d7bf9eab12ea2d3fce127f0dcff.tar.bz2 Ishtar-7520106958557d7bf9eab12ea2d3fce127f0dcff.zip |
Serialization: directory
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r-- | ishtar_common/tests.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index efa0188ff..99840ddaa 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -53,7 +53,8 @@ from ishtar_common.apps import admin_site from ishtar_common.serializers import type_serialization, \ SERIALIZATION_VERSION, serialization_info, \ restore_serialized, conf_serialization, CONF_MODEL_LIST, \ - importer_serialization, IMPORT_MODEL_LIST, geo_serialization, GEO_MODEL_LIST + importer_serialization, IMPORT_MODEL_LIST, geo_serialization, \ + GEO_MODEL_LIST, directory_serialization, DIRECTORY_MODEL_LIST from ishtar_common.utils import post_save_geo, update_data, move_dict_data, \ rename_and_simplify_media_name, try_fix_file @@ -681,6 +682,20 @@ class SerializationTest(TestCase): self.create_geo_default() self.generic_serialization_test(geo_serialization) + def create_directory_default(self): + org = models.Organization.objects.create( + name="Test", + organization_type=models.OrganizationType.objects.all()[0]) + person = models.Person.objects.create( + name="Test", attached_to=org + ) + models.Author.objects.create( + person=person, author_type=models.AuthorType.objects.all()[0]) + + def test_directory_serialization(self): + self.create_directory_default() + self.generic_serialization_test(directory_serialization) + def test_serialization_zip(self): zip_filename = type_serialization(archive=True) # only check the validity of the zip, the type content is tested above @@ -787,6 +802,13 @@ class SerializationTest(TestCase): # no geo restore self.assertFalse(models.Town.objects.get(numero_insee="12345").center) + def test_directory_restore(self): + self.create_directory_default() + current_number, zip_filename = self.generic_restore_test_genzip( + DIRECTORY_MODEL_LIST, directory_serialization) + self.generic_restore_test(zip_filename, current_number, + DIRECTORY_MODEL_LIST) + class AccessControlTest(TestCase): def test_administrator(self): |