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.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index aa67d2e6b..9c7beb28a 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -614,10 +614,15 @@ class GenericSerializationTest:
result = json.loads(json_result[key])
serialization_count = len(result)
# all serialization have to be tested
- self.assertTrue(serialization_count)
+ self.assertTrue(serialization_count,
+ msg="No data to test for {}".format(key))
# only "natural" serialization
- self.assertNotIn("pk", result[0])
- self.assertNotIn("id", result[0])
+ self.assertNotIn(
+ "pk", result[0],
+ msg="Serialization for {} do not use natural keys".format(key))
+ self.assertNotIn(
+ "id", result[0],
+ msg="Serialization for {} do not use natural keys".format(key))
# has to be at least equal (can be superior for model with
# recursion)
self.assertTrue(
@@ -652,12 +657,23 @@ class GenericSerializationTest:
class SerializationTest(GenericSerializationTest, TestCase):
fixtures = COMMON_FIXTURES + WAREHOUSE_FIXTURES
+ def create_types(self):
+ from archaeological_finds.models import MaterialTypeQualityType, \
+ ObjectTypeQualityType, AlterationType, AlterationCauseType, \
+ TreatmentEmergencyType, CommunicabilityType
+ for model in (models.LicenseType, MaterialTypeQualityType,
+ ObjectTypeQualityType, AlterationType,
+ AlterationCauseType, TreatmentEmergencyType,
+ CommunicabilityType):
+ model.objects.create(txt_idx="test", label="Test")
+
def test_type_serialization(self):
+ self.create_types()
self.generic_serialization_test(type_serialization)
def create_default_conf(self):
values = {}
- models.get_current_profile() # create a default profile
+ models.get_current_profile(force=True) # create a default profile
models.GlobalVar.objects.create(slug="test")
cform = models.CustomForm.objects.create(
name="Test", form='ishtar_common.forms.TestForm')
@@ -758,6 +774,7 @@ class SerializationTest(GenericSerializationTest, TestCase):
from archaeological_operations.models import RelationType as OperationRT
cr_rel_type_nb = CRRT.objects.count()
ope_rel_type_nb = OperationRT.objects.count()
+ self.create_types()
models.AuthorType.objects.create(label="Test", txt_idx="test")