diff options
Diffstat (limited to 'archaeological_context_records/tests.py')
| -rw-r--r-- | archaeological_context_records/tests.py | 37 | 
1 files changed, 35 insertions, 2 deletions
diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index 29670b1a3..024a8f338 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -42,9 +42,10 @@ from ishtar_common.utils import generate_relation_graph  from ishtar_common.tests import WizardTest, WizardTestFormData as FormData, \      create_superuser, create_user, TestCase, AutocompleteTestBase, AcItem, \      CONTEXT_RECORD_FIXTURES, CONTEXT_RECORD_TOWNS_FIXTURES, \ -    OPERATION_TOWNS_FIXTURES +    OPERATION_TOWNS_FIXTURES, GenericSerializationTest, COMMON_FIXTURES, \ +    WAREHOUSE_FIXTURES -from archaeological_context_records import views +from archaeological_context_records import views, serializers  class ImportContextRecordTest(ImportTest, TestCase): @@ -205,6 +206,38 @@ class ContextRecordInit(OperationInitTest):          super(ContextRecordInit, self).tearDown() +class SerializationTest(GenericSerializationTest, ContextRecordInit, TestCase): +    fixtures = COMMON_FIXTURES + WAREHOUSE_FIXTURES + +    def setUp(self): +        cr = self.create_context_record(data={"label": u"CR 1"})[0] +        cr2 = self.create_context_record(data={"label": u"CR 2"})[1] +        dating = models.Dating.objects.create( +            period=models.Period.objects.all()[0], +        ) +        cr.datings.add(dating) +        rlt = models.RelationType.objects.create( +            label="Test", +            txt_idx="test", +            symmetrical=False +        ) +        models.RecordRelations.objects.create( +            left_record=cr, +            right_record=cr2, +            relation_type=rlt +        ) + +    def test_serialization(self): +        self.generic_serialization_test(serializers.cr_serialization) + +    def test_restore(self): +        current_number, zip_filename = self.generic_restore_test_genzip( +            serializers.CR_MODEL_LIST, +            serializers.cr_serialization) +        self.generic_restore_test(zip_filename, current_number, +                                  serializers.CR_MODEL_LIST) + +  class ExportTest(ContextRecordInit, TestCase):      fixtures = CONTEXT_RECORD_TOWNS_FIXTURES  | 
