summaryrefslogtreecommitdiff
path: root/ishtar_common/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r--ishtar_common/tests.py44
1 files changed, 41 insertions, 3 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index b814cbe5c..22876784c 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -63,6 +63,7 @@ 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
+from ishtar_common.tasks import launch_export
COMMON_FIXTURES = [
@@ -670,8 +671,9 @@ class GenericSerializationTest:
current_nb = model.objects.count()
self.assertEqual(
previous_nb, current_nb,
- msg="Restore for model {} failed. Initial: {}, restored: "
- "{}.".format(model.__name__, previous_nb, current_nb))
+ msg="Restore for model {}.{} failed. Initial: {}, restored: "
+ "{}.".format(model.__module__, model.__name__,
+ previous_nb, current_nb))
class SerializationTest(GenericSerializationTest, TestCase):
@@ -1054,13 +1056,16 @@ class SerializationTest(GenericSerializationTest, TestCase):
self.generic_restore_test(zip_filename, current_number,
[models.Document])
- def test_full_restore(self):
+ def full_create(self):
self.create_types()
self.create_default_conf()
self.create_default_importer()
self.create_geo_default()
self.create_directory_default()
self.create_document_default()
+
+ def test_full_restore(self):
+ self.full_create()
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
@@ -1069,6 +1074,39 @@ class SerializationTest(GenericSerializationTest, TestCase):
self.generic_restore_test(zip_filename, current_number,
model_list)
+ def test_export_action(self):
+ self.full_create()
+ 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
+ task = models.ExportTask.objects.create(state="S")
+ launch_export(task)
+ current_number = {}
+ for model in model_list:
+ current_number[(model.__module__, model.__name__)] = \
+ model.objects.count()
+ self.generic_restore_test(task.result.path, current_number,
+ model_list)
+
+ task = models.ExportTask.objects.create(
+ filter_type="O", filter_text="66666", state="S")
+ current_number.update(
+ {
+ ("archaeological_operations.models", "ArchaeologicalSite"): 1,
+ ("archaeological_operations.models", "Operation"): 1,
+ ("archaeological_context_records.models", "ContextRecord"): 1,
+ ("archaeological_finds.models_finds", "BaseFind"): 1,
+ ("archaeological_finds.models_finds", "Find"): 1,
+ ("archaeological_warehouse.models", "Warehouse"): 1,
+ ("archaeological_warehouse.models", "Container"): 1,
+ ("archaeological_warehouse.models", "WarehouseDivisionLink"): 1,
+ ("archaeological_warehouse.models", "ContainerLocalisation"): 1,
+ }
+ )
+ launch_export(task)
+ self.generic_restore_test(task.result.path, current_number,
+ model_list)
+
class AccessControlTest(TestCase):
def test_administrator(self):