Commit c40ffec6 authored by Łukasz Nowak's avatar Łukasz Nowak

Restore Software Product constraint.

They were lost during migration from filesystem based constraint.
parent f0817fe7
...@@ -6,10 +6,32 @@ ...@@ -6,10 +6,32 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>VifibSoftwareProductConstraint</string> </value> <value> <string>VifibSoftwareProductConstraint</string> </value>
</item> </item>
<item>
<key> <string>last_id</string> </key>
<value> <string>3</string> </value>
</item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Property Sheet</string> </value> <value> <string>Property Sheet</string> </value>
...@@ -17,4 +39,26 @@ ...@@ -17,4 +39,26 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData> </ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="String Attribute Match 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>_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>
<tuple>
<string>title</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>title_not_empty_constraint</string> </value>
</item>
<item>
<key> <string>message_attribute_match</string> </key>
<value> <string>Title should be defined</string> </value>
</item>
<item>
<key> <string>message_no_such_property</string> </key>
<value> <string>Title should be defined</string> </value>
</item>
<item>
<key> <string>message_property_not_set</string> </key>
<value> <string>Title should be defined</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>String Attribute Match Constraint</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>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Attribute Unicity 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>constraint_property</string> </key>
<value>
<tuple>
<string>title</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Title already exists</string> </value>
</item>
<item>
<key> <string>filter_parameter</string> </key>
<value> <string>python: {\'portal_type\': object.getPortalType(), \'title\': object.getTitle()}</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>title_unicity_constraint</string> </value>
</item>
<item>
<key> <string>message_invalid_attribute_unicity</string> </key>
<value> <string>Title already exists</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Attribute Unicity Constraint</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>
##############################################################################
#
# Copyright (c) 2002-2011 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from VifibMixin import testVifibMixin
import random
def rndstr():
return str(random.random())
def getMessageList(o):
return [str(q.getMessage()) for q in o.checkConsistency()]
class TestVifibSoftwareProductConstraint(testVifibMixin):
def getTitle(self):
return "Vifib Constraint checks"
def test_title_not_empty(self):
software_product = self.portal.software_product_module.newContent(
portal_type='Software Product')
consistency_message = 'Title should be defined'
self.assertTrue(consistency_message in getMessageList(software_product))
software_product.edit(title=rndstr())
self.assertFalse(consistency_message in getMessageList(software_product))
def test_title_unique(self):
title = rndstr()
title_2 = rndstr()
consistency_message = 'Title already exists'
software_product = self.portal.software_product_module.newContent(
portal_type='Software Product', title=title)
software_product_2 = self.portal.software_product_module.newContent(
portal_type='Software Product', title=title)
self.stepTic()
self.assertTrue(consistency_message in getMessageList(software_product))
self.assertTrue(consistency_message in getMessageList(software_product_2))
software_product_2.setTitle(title_2)
self.stepTic()
self.assertFalse(consistency_message in getMessageList(software_product))
self.assertFalse(consistency_message in getMessageList(software_product_2))
189 190
\ No newline at end of file \ No newline at end of file
...@@ -5,3 +5,4 @@ testVifibUserCustomer ...@@ -5,3 +5,4 @@ testVifibUserCustomer
testVifibUserDeveloper testVifibUserDeveloper
testVifibSlapgrid2 testVifibSlapgrid2
ViFiBOrderTest ViFiBOrderTest
testVifibConstraint
\ 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