Commit 97c4955d authored by Łukasz Nowak's avatar Łukasz Nowak

Check that local properties are really removed.

parent 3b935ad2
...@@ -1254,6 +1254,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1254,6 +1254,7 @@ class TestConstraint(PropertySheetTestCase):
id='type_validity_constraint', ) id='type_validity_constraint', )
obj = self._makeOne() obj = self._makeOne()
obj.edit(default_organisation_title='foo') obj.edit(default_organisation_title='foo')
self.assertEqual(1, len(obj._local_properties))
self.assertEquals([], constraint.checkConsistency(obj)) self.assertEquals([], constraint.checkConsistency(obj))
# now add a 'local_property' property defined on a property sheet # now add a 'local_property' property defined on a property sheet
self._addProperty(obj.getPortalType(), "FixLocalPropertiesContent", self._addProperty(obj.getPortalType(), "FixLocalPropertiesContent",
...@@ -1271,8 +1272,8 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1271,8 +1272,8 @@ class TestConstraint(PropertySheetTestCase):
ti._setTypeAllowedContentTypeList(allowed_types + ['Organisation']) ti._setTypeAllowedContentTypeList(allowed_types + ['Organisation'])
transaction.commit() transaction.commit()
try: try:
self.assertEqual(['Property local_property was migrated from local properties.'], constraint.fixConsistency(obj)
[str(q.getMessage()) for q in constraint.fixConsistency(obj)]) self.assertEqual(0, len(obj._local_properties))
self.assertEquals('foo', obj.getDefaultOrganisationTitle()) self.assertEquals('foo', obj.getDefaultOrganisationTitle())
self.assertEquals('foo', obj.default_organisation.getTitle()) self.assertEquals('foo', obj.default_organisation.getTitle())
finally: finally:
...@@ -1290,15 +1291,16 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1290,15 +1291,16 @@ class TestConstraint(PropertySheetTestCase):
id='type_validity_constraint', ) id='type_validity_constraint', )
obj = self._makeOne() obj = self._makeOne()
obj.edit(testing_category=obj.getRelativeUrl()) obj.edit(testing_category=obj.getRelativeUrl())
self.assertEqual(1, len(obj._local_properties))
self.assertEquals([], constraint.checkConsistency(obj)) self.assertEquals([], constraint.checkConsistency(obj))
# now add a 'local_property' property defined on a property sheet # now add a 'local_property' property defined on a property sheet
self._addProperty(obj.getPortalType(), "FixForCategories", self._addProperty(obj.getPortalType(), "FixForCategories",
portal_type="Category Property", portal_type="Category Property",
property_id="testing_category") property_id="testing_category")
# fix consistency # fix consistency
self.assertEqual(['Property local_property was migrated from local properties.'], constraint.fixConsistency(obj)
[str(q.getMessage()) for q in constraint.fixConsistency(obj)])
# now we can use testing_category as any category accessor # now we can use testing_category as any category accessor
self.assertEqual(0, len(obj._local_properties))
self.assertEquals(obj, obj.getTestingCategoryValue()) self.assertEquals(obj, obj.getTestingCategoryValue())
def stepCreateContentExistence(self, sequence=None, sequence_list=None, **kw): def stepCreateContentExistence(self, sequence=None, sequence_list=None, **kw):
......
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