mirror of
https://github.com/yweber/lodel2.git
synced 2026-03-19 09:42:01 +01:00
Tests EmType
This commit is contained in:
parent
3f250baea8
commit
61893313af
1 changed files with 16 additions and 5 deletions
|
|
@ -8,7 +8,7 @@ import unittest
|
|||
|
||||
from EditorialModel.types import EmType
|
||||
from EditorialModel.classes import EmClass
|
||||
from EditorialModel.classtypes import EmClassType
|
||||
from EditorialModel.classtypes import EmClassType, EmNature
|
||||
from EditorialModel.components import EmComponent
|
||||
from EditorialModel.fieldgroups import EmFieldGroup
|
||||
from EditorialModel.fieldtypes import *
|
||||
|
|
@ -40,14 +40,14 @@ class TypeTestCase(TestCase):
|
|||
|
||||
self.emclass1 = EmClass.create("entity1", EmClassType.entity)
|
||||
self.emclass2 = EmClass.create("entity2", EmClassType.entity)
|
||||
|
||||
self.emtype = EmType.create('type1',self.emclass2)
|
||||
self.emfieldgroup = EmFieldGroup.create('fieldgroup1',self.emclass1)
|
||||
self.emtype = EmType.create(name='type1', em_class=self.emclass2)
|
||||
self.emtype2 = EmType.create(name='type2', em_class=self.emclass2)
|
||||
self.emtype3 = EmType.create(name='type3', em_class=self.emclass2)
|
||||
self.emfieldgroup = EmFieldGroup.create(name='fieldgroup1', em_class=self.emclass1)
|
||||
self.emfieldtype = get_field_type('integer')
|
||||
self.emfield = EmField.create(name='field1', fieldgroup=self.emfieldgroup, fieldtype=self.emfieldtype, rel_to_type_id=self.emtype.uid)
|
||||
|
||||
restoreDbState(TEST_TYPE_DBNAME)
|
||||
pass
|
||||
|
||||
class TestSelectField(TypeTestCase):
|
||||
def testSelectField(self):
|
||||
|
|
@ -58,3 +58,14 @@ class TestSelectField(TypeTestCase):
|
|||
self.emtype.unselect_field(self.emfield)
|
||||
self.assertFalse(Em_Field_Type(self.emtype.uid, self.emfield.uid).exists())
|
||||
|
||||
class TestLinkedTypes(TypeTestCase):
|
||||
def testLinkedtypes(self):
|
||||
self.emtype.add_superior(self.emtype2, EmNature.PARENT)
|
||||
self.emtype3.add_superior(self.emtype, EmNature.PARENT)
|
||||
|
||||
linked_types = self.emtype.linked_types()
|
||||
|
||||
self.assertEqual(len(linked_types),2)
|
||||
self.assertNotIn(self.emtype,linked_types)
|
||||
self.assertIn(self.emtype2, linked_types)
|
||||
self.assertIn(self.emtype3, linked_types)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue