Commit 26fd3cd6 authored by Łukasz Nowak's avatar Łukasz Nowak

Restore Person constraints.

parent 55c53707
......@@ -28,6 +28,10 @@
<key> <string>id</string> </key>
<value> <string>VifibPersonConstraint</string> </value>
</item>
<item>
<key> <string>last_id</string> </key>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Sheet</string> </value>
......
......@@ -6,6 +6,18 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>constraint_portal_type</string> </key>
<value> <string>python: (\'Email\',)</string> </value>
......@@ -18,6 +30,14 @@
<key> <string>id</string> </key>
<value> <string>default_email_constraint</string> </value>
</item>
<item>
<key> <string>message_no_subobject</string> </key>
<value> <string>Person have to contain an Email</string> </value>
</item>
<item>
<key> <string>message_no_subobject_portal_type</string> </key>
<value> <string>Person have to contain an Email</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Content Existence Constraint</string> </value>
......@@ -25,4 +45,34 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -6,6 +6,35 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>message_property_not_set</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>constraint_property</string> </key>
<value>
......@@ -22,6 +51,14 @@
<key> <string>id</string> </key>
<value> <string>property_existence_constraint</string> </value>
</item>
<item>
<key> <string>message_no_such_property</string> </key>
<value> <string>Property last_name must be defined</string> </value>
</item>
<item>
<key> <string>message_property_not_set</string> </key>
<value> <string>Property last_name must be defined</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Existence Constraint</string> </value>
......@@ -29,4 +66,34 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Acquired Membership State Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>base_category</string> </key>
<value> <string>subordination</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>subordination_state_constraint</string> </value>
</item>
<item>
<key> <string>membership_portal_type_list</string> </key>
<value> <string>python: (\'Organisation\',)</string> </value>
</item>
<item>
<key> <string>message_different_state</string> </key>
<value> <string>The Organisation is not validated</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Acquired Membership State Constraint</string> </value>
</item>
<item>
<key> <string>workflow_state_list</string> </key>
<value> <string>python: \'validated\'</string> </value>
</item>
<item>
<key> <string>workflow_variable</string> </key>
<value> <string>validation_state</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -284,3 +284,55 @@ class TestVifibInternalPackingListLineConstraint(testVifibMixin):
line.setAggregate(aggregate.getRelativeUrl())
self.assertFalse(consistency_message in getMessageList(line))
class testVifibPersonConstraint(testVifibMixin):
def getTitle(self):
return "Vifib Person Constraint checks"
def test_last_name_existence(self):
person = self.portal.person_module.newContent(portal_type='Person')
consistency_message = 'Property last_name must be defined'
self.assertTrue(consistency_message in getMessageList(person))
person.setLastName(rndstr())
self.assertFalse(consistency_message in getMessageList(person))
def test_role(self):
person = self.portal.person_module.newContent(portal_type='Person')
consistency_message = 'One role should be defined'
self.assertTrue(consistency_message in getMessageList(person))
role_id_list = list(self.portal.portal_categories.role.objectIds())
self.assertTrue(len(role_id_list) >= 2)
person.setRole(role_id_list[0])
self.assertFalse(consistency_message in getMessageList(person))
person.setRoleList(role_id_list)
self.assertTrue(consistency_message in getMessageList(person))
person.setRole(role_id_list[0])
self.assertFalse(consistency_message in getMessageList(person))
def test_subordination_state(self):
organisation = self.portal.organisation_module.newContent(
portal_type='Organisation')
person = self.portal.person_module.newContent(portal_type='Person',
subordination=organisation.getRelativeUrl())
consistency_message = 'The Organisation is not validated'
self.assertTrue(consistency_message in getMessageList(person))
organisation.validate()
self.assertFalse(consistency_message in getMessageList(person))
def test_email(self):
person = self.portal.person_module.newContent(portal_type='Person')
consistency_message = 'Person have to contain an Email'
self.assertTrue(consistency_message in getMessageList(person))
person.newContent(portal_type='Email')
self.assertFalse(consistency_message in getMessageList(person))
197
\ No newline at end of file
198
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment