diff options
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r-- | ishtar_common/tests.py | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 96737c765..9313a8432 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -55,7 +55,11 @@ from ishtar_common.serializers import type_serialization, \ restore_serialized, conf_serialization, CONF_MODEL_LIST, \ importer_serialization, IMPORT_MODEL_LIST, geo_serialization, \ GEO_MODEL_LIST, directory_serialization, DIRECTORY_MODEL_LIST, \ - document_serialization + document_serialization, get_type_models +from archaeological_operations.serializers import OPERATION_MODEL_LIST +from archaeological_context_records.serializers import CR_MODEL_LIST +from archaeological_finds.serializers import FIND_MODEL_LIST +from archaeological_warehouse.serializers import WAREHOUSE_MODEL_LIST from ishtar_common.serializers_utils import serialization_info from ishtar_common.utils import post_save_geo, update_data, move_dict_data, \ rename_and_simplify_media_name, try_fix_file @@ -651,7 +655,8 @@ class GenericSerializationTest: kwargs=None): current_number = {} for model in model_list: - current_number[model.__name__] = model.objects.count() + current_number[(model.__module__, model.__name__)] = \ + model.objects.count() if not kwargs: kwargs = {} kwargs["archive"] = True @@ -661,7 +666,7 @@ class GenericSerializationTest: def generic_restore_test(self, zip_filename, current_number, model_list): restore_serialized(zip_filename, delete_existing=True) for model in model_list: - previous_nb = current_number[model.__name__] + previous_nb = current_number[(model.__module__, model.__name__)] current_nb = model.objects.count() self.assertEqual( previous_nb, current_nb, @@ -1049,6 +1054,21 @@ class SerializationTest(GenericSerializationTest, TestCase): self.generic_restore_test(zip_filename, current_number, [models.Document]) + def test_full_restore(self): + self.create_types() + self.create_default_conf() + self.create_default_importer() + self.create_geo_default() + self.create_directory_default() + self.create_document_default() + model_list = get_type_models() + CONF_MODEL_LIST + IMPORT_MODEL_LIST + \ + GEO_MODEL_LIST + DIRECTORY_MODEL_LIST + OPERATION_MODEL_LIST + \ + CR_MODEL_LIST + FIND_MODEL_LIST + WAREHOUSE_MODEL_LIST + current_number, zip_filename = self.generic_restore_test_genzip( + model_list, document_serialization) + self.generic_restore_test(zip_filename, current_number, + model_list) + class AccessControlTest(TestCase): def test_administrator(self): |