Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Klaus Wölfel
erp5
Commits
3dbd9cd1
Commit
3dbd9cd1
authored
Mar 06, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use preferred assertion names.
parent
69e89cec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
48 deletions
+48
-48
product/ERP5Type/tests/testConstraint.py
product/ERP5Type/tests/testConstraint.py
+48
-48
No files found.
product/ERP5Type/tests/testConstraint.py
View file @
3dbd9cd1
...
@@ -126,7 +126,7 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -126,7 +126,7 @@ class TestConstraint(PropertySheetTestCase):
# group1 = object.portal_categories.restrictedTraverse('group/testGroup1')
# group1 = object.portal_categories.restrictedTraverse('group/testGroup1')
# object.edit(group_value=group1)
# object.edit(group_value=group1)
object
.
edit
(
group
=
'testGroup1'
)
object
.
edit
(
group
=
'testGroup1'
)
self
.
assertNotEqual
s
(
self
.
assertNotEqual
(
object
.
getGroup
(
portal_type
=
()),
object
.
getGroup
(
portal_type
=
()),
None
)
None
)
...
@@ -138,7 +138,7 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -138,7 +138,7 @@ class TestConstraint(PropertySheetTestCase):
object
=
sequence
.
get
(
'object'
)
object
=
sequence
.
get
(
'object'
)
object
.
setGroup
(
object
.
getRelativeUrl
(),
object
.
setGroup
(
object
.
getRelativeUrl
(),
portal_type
=
'Organisation'
)
portal_type
=
'Organisation'
)
self
.
assertNotEqual
s
(
self
.
assertNotEqual
(
object
.
getGroup
(
portal_type
=
'Organisation'
),
object
.
getGroup
(
portal_type
=
'Organisation'
),
None
)
None
)
...
@@ -285,7 +285,7 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -285,7 +285,7 @@ class TestConstraint(PropertySheetTestCase):
"error_list : %s"
%
error_list
)
"error_list : %s"
%
error_list
)
# call getTranslatedMessage, to make sure messages have a valid mapping.
# call getTranslatedMessage, to make sure messages have a valid mapping.
for
error
in
error_list
:
for
error
in
error_list
:
self
.
assertNotEqual
s
(
''
,
self
.
assertNotEqual
(
''
,
error
.
getTranslatedMessage
())
error
.
getTranslatedMessage
())
...
@@ -965,10 +965,10 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -965,10 +965,10 @@ class TestConstraint(PropertySheetTestCase):
klass_name
=
'CategoryMembershipArity'
,
klass_name
=
'CategoryMembershipArity'
,
min_arity
=
1
)
min_arity
=
1
)
message_list
=
constraint
.
checkConsistency
(
obj
)
message_list
=
constraint
.
checkConsistency
(
obj
)
self
.
assertEqual
s
(
1
,
len
(
message_list
))
self
.
assertEqual
(
1
,
len
(
message_list
))
self
.
assertNotEqual
s
(
''
,
message_list
[
0
].
getTranslatedMessage
())
self
.
assertNotEqual
(
''
,
message_list
[
0
].
getTranslatedMessage
())
obj
.
setGroup
(
'testGroup1'
)
obj
.
setGroup
(
'testGroup1'
)
self
.
assertEqual
s
(
0
,
len
(
constraint
.
checkConsistency
(
obj
)))
self
.
assertEqual
(
0
,
len
(
constraint
.
checkConsistency
(
obj
)))
def
test_CategoryAcquiredMembershipArityNoMax
(
self
):
def
test_CategoryAcquiredMembershipArityNoMax
(
self
):
obj
=
self
.
_makeOne
()
obj
=
self
.
_makeOne
()
...
@@ -979,10 +979,10 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -979,10 +979,10 @@ class TestConstraint(PropertySheetTestCase):
klass_name
=
'CategoryAcquiredMembershipArity'
,
klass_name
=
'CategoryAcquiredMembershipArity'
,
min_arity
=
1
)
min_arity
=
1
)
message_list
=
constraint
.
checkConsistency
(
obj
)
message_list
=
constraint
.
checkConsistency
(
obj
)
self
.
assertEqual
s
(
1
,
len
(
message_list
))
self
.
assertEqual
(
1
,
len
(
message_list
))
self
.
assertNotEqual
s
(
''
,
message_list
[
0
].
getTranslatedMessage
())
self
.
assertNotEqual
(
''
,
message_list
[
0
].
getTranslatedMessage
())
obj
.
setGroup
(
'testGroup1'
)
obj
.
setGroup
(
'testGroup1'
)
self
.
assertEqual
s
(
0
,
len
(
constraint
.
checkConsistency
(
obj
)))
self
.
assertEqual
(
0
,
len
(
constraint
.
checkConsistency
(
obj
)))
def
stepCreateCategoryRelatedMembershipArity0
(
self
,
sequence
=
None
,
def
stepCreateCategoryRelatedMembershipArity0
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
...
@@ -1109,19 +1109,19 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1109,19 +1109,19 @@ class TestConstraint(PropertySheetTestCase):
klass_name
=
'CategoryRelatedMembershipArity'
,
klass_name
=
'CategoryRelatedMembershipArity'
,
min_arity
=
1
)
min_arity
=
1
)
message_list
=
constraint
.
checkConsistency
(
obj
)
message_list
=
constraint
.
checkConsistency
(
obj
)
self
.
assertEqual
s
(
1
,
len
(
message_list
))
self
.
assertEqual
(
1
,
len
(
message_list
))
self
.
assertNotEqual
s
(
''
,
message_list
[
0
].
getTranslatedMessage
())
self
.
assertNotEqual
(
''
,
message_list
[
0
].
getTranslatedMessage
())
related_obj
.
setGroupValue
(
obj
)
related_obj
.
setGroupValue
(
obj
)
transaction
.
commit
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
self
.
assertEqual
s
(
0
,
len
(
constraint
.
checkConsistency
(
obj
)))
self
.
assertEqual
(
0
,
len
(
constraint
.
checkConsistency
(
obj
)))
def
test_BooleanPropertiesPropertyTypeValidity
(
self
):
def
test_BooleanPropertiesPropertyTypeValidity
(
self
):
"""Tests PropertyTypeValidity can handle boolean values.
"""Tests PropertyTypeValidity can handle boolean values.
"""
"""
obj
=
self
.
_makeOne
()
obj
=
self
.
_makeOne
()
obj
.
manage_addProperty
(
'dummy_boolean_property'
,
True
,
type
=
'boolean'
)
obj
.
manage_addProperty
(
'dummy_boolean_property'
,
True
,
type
=
'boolean'
)
self
.
assertEqual
s
([],
obj
.
checkConsistency
())
self
.
assertEqual
([],
obj
.
checkConsistency
())
def
test_BooleanPropertiesPropertyTypeValidityFix
(
self
):
def
test_BooleanPropertiesPropertyTypeValidityFix
(
self
):
"""Tests PropertyTypeValidity can fix boolean values.
"""Tests PropertyTypeValidity can fix boolean values.
...
@@ -1132,7 +1132,7 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1132,7 +1132,7 @@ class TestConstraint(PropertySheetTestCase):
obj
.
setProperty
(
prop_name
,
2
)
obj
.
setProperty
(
prop_name
,
2
)
obj
.
fixConsistency
()
obj
.
fixConsistency
()
# should be fixed now
# should be fixed now
self
.
assertEqual
s
([],
obj
.
checkConsistency
())
self
.
assertEqual
([],
obj
.
checkConsistency
())
self
.
failUnless
(
obj
.
getPropertyType
(
prop_name
))
self
.
failUnless
(
obj
.
getPropertyType
(
prop_name
))
def
test_TALESConstraint
(
self
):
def
test_TALESConstraint
(
self
):
...
@@ -1143,11 +1143,11 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1143,11 +1143,11 @@ class TestConstraint(PropertySheetTestCase):
id
=
'tales_constraint'
,
id
=
'tales_constraint'
,
expression
=
'python: object.getTitle() != "foo"'
)
expression
=
'python: object.getTitle() != "foo"'
)
obj
=
self
.
_makeOne
()
obj
=
self
.
_makeOne
()
self
.
assertEqual
s
([],
constraint
.
checkConsistency
(
obj
))
self
.
assertEqual
([],
constraint
.
checkConsistency
(
obj
))
obj
.
setTitle
(
'foo'
)
obj
.
setTitle
(
'foo'
)
message_list
=
constraint
.
checkConsistency
(
obj
)
message_list
=
constraint
.
checkConsistency
(
obj
)
self
.
assertEqual
s
(
1
,
len
(
message_list
))
self
.
assertEqual
(
1
,
len
(
message_list
))
self
.
assertNotEqual
s
(
''
,
message_list
[
0
].
getTranslatedMessage
())
self
.
assertNotEqual
(
''
,
message_list
[
0
].
getTranslatedMessage
())
def
test_TALESConstraintInvalidExpression
(
self
):
def
test_TALESConstraintInvalidExpression
(
self
):
"""Tests TALESConstraint with an invalid expression
"""Tests TALESConstraint with an invalid expression
...
@@ -1159,8 +1159,8 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1159,8 +1159,8 @@ class TestConstraint(PropertySheetTestCase):
obj
=
self
.
_makeOne
()
obj
=
self
.
_makeOne
()
# an error during expression evaluation simply makes a consistency error
# an error during expression evaluation simply makes a consistency error
message_list
=
constraint
.
checkConsistency
(
obj
)
message_list
=
constraint
.
checkConsistency
(
obj
)
self
.
assertEqual
s
(
1
,
len
(
message_list
))
self
.
assertEqual
(
1
,
len
(
message_list
))
self
.
assertNotEqual
s
(
''
,
message_list
[
0
].
getTranslatedMessage
())
self
.
assertNotEqual
(
''
,
message_list
[
0
].
getTranslatedMessage
())
# an error during expression compilation is reraised to the programmer
# an error during expression compilation is reraised to the programmer
constraint
=
self
.
_createGenericConstraint
(
constraint
=
self
.
_createGenericConstraint
(
...
@@ -1191,12 +1191,12 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1191,12 +1191,12 @@ class TestConstraint(PropertySheetTestCase):
elementary_type
=
"string"
)
elementary_type
=
"string"
)
obj
.
edit
(
local_property
=
'1'
)
obj
.
edit
(
local_property
=
'1'
)
self
.
assertFalse
(
'_local_properties'
in
obj
.
__dict__
)
self
.
assertFalse
(
'_local_properties'
in
obj
.
__dict__
)
self
.
assertEqual
s
([],
constraint
.
checkConsistency
(
obj
))
self
.
assertEqual
([],
constraint
.
checkConsistency
(
obj
))
self
.
assertEqual
([],
constraint
.
fixConsistency
(
obj
))
self
.
assertEqual
([],
constraint
.
fixConsistency
(
obj
))
self
.
assertFalse
(
'_local_properties'
in
obj
.
__dict__
)
self
.
assertFalse
(
'_local_properties'
in
obj
.
__dict__
)
self
.
assertEqual
s
(
'1'
,
obj
.
getLocalProperty
())
self
.
assertEqual
(
'1'
,
obj
.
getLocalProperty
())
obj
.
edit
(
local_property
=
'something else'
)
obj
.
edit
(
local_property
=
'something else'
)
self
.
assertEqual
s
(
'something else'
,
obj
.
getLocalProperty
())
self
.
assertEqual
(
'something else'
,
obj
.
getLocalProperty
())
def
test_PropertyTypeValidityFixLocalPropertiesString
(
self
):
def
test_PropertyTypeValidityFixLocalPropertiesString
(
self
):
"""Tests PropertyTypeValidity can repairs local property when this property
"""Tests PropertyTypeValidity can repairs local property when this property
...
@@ -1207,8 +1207,8 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1207,8 +1207,8 @@ class TestConstraint(PropertySheetTestCase):
id
=
'type_validity_constraint'
,
)
id
=
'type_validity_constraint'
,
)
obj
=
self
.
_makeOne
()
obj
=
self
.
_makeOne
()
obj
.
edit
(
local_property
=
'1'
)
obj
.
edit
(
local_property
=
'1'
)
self
.
assertEqual
s
(
1
,
len
(
obj
.
_local_properties
))
self
.
assertEqual
(
1
,
len
(
obj
.
_local_properties
))
self
.
assertEqual
s
([],
constraint
.
checkConsistency
(
obj
))
self
.
assertEqual
([],
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
(),
"FixLocalPropertiesString"
,
self
.
_addProperty
(
obj
.
getPortalType
(),
"FixLocalPropertiesString"
,
portal_type
=
"Standard Property"
,
portal_type
=
"Standard Property"
,
...
@@ -1216,10 +1216,10 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1216,10 +1216,10 @@ class TestConstraint(PropertySheetTestCase):
elementary_type
=
"string"
)
elementary_type
=
"string"
)
self
.
assertEqual
([
'Property local_property was migrated from local properties.'
],
self
.
assertEqual
([
'Property local_property was migrated from local properties.'
],
[
str
(
q
.
getMessage
())
for
q
in
constraint
.
fixConsistency
(
obj
)])
[
str
(
q
.
getMessage
())
for
q
in
constraint
.
fixConsistency
(
obj
)])
self
.
assertEqual
s
((),
obj
.
_local_properties
)
self
.
assertEqual
((),
obj
.
_local_properties
)
self
.
assertEqual
s
(
'1'
,
obj
.
getLocalProperty
())
self
.
assertEqual
(
'1'
,
obj
.
getLocalProperty
())
obj
.
edit
(
local_property
=
'something else'
)
obj
.
edit
(
local_property
=
'something else'
)
self
.
assertEqual
s
(
'something else'
,
obj
.
getLocalProperty
())
self
.
assertEqual
(
'something else'
,
obj
.
getLocalProperty
())
def
test_PropertyTypeValidityFixLocalPropertiesFloat
(
self
):
def
test_PropertyTypeValidityFixLocalPropertiesFloat
(
self
):
"""Tests PropertyTypeValidity can repairs local property when this property
"""Tests PropertyTypeValidity can repairs local property when this property
...
@@ -1230,8 +1230,8 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1230,8 +1230,8 @@ class TestConstraint(PropertySheetTestCase):
id
=
'type_validity_constraint'
,
)
id
=
'type_validity_constraint'
,
)
obj
=
self
.
_makeOne
()
obj
=
self
.
_makeOne
()
obj
.
edit
(
local_property
=
1.234
)
obj
.
edit
(
local_property
=
1.234
)
self
.
assertEqual
s
(
1
,
len
(
obj
.
_local_properties
))
self
.
assertEqual
(
1
,
len
(
obj
.
_local_properties
))
#self.assertEqual
s
([], constraint.checkConsistency(obj))
#self.assertEqual([], 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
(),
"FixLocalPropertiesFloat"
,
self
.
_addProperty
(
obj
.
getPortalType
(),
"FixLocalPropertiesFloat"
,
portal_type
=
"Standard Property"
,
portal_type
=
"Standard Property"
,
...
@@ -1239,10 +1239,10 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1239,10 +1239,10 @@ class TestConstraint(PropertySheetTestCase):
elementary_type
=
"float"
)
elementary_type
=
"float"
)
self
.
assertEqual
([
'Property local_property was migrated from local properties.'
],
self
.
assertEqual
([
'Property local_property was migrated from local properties.'
],
[
str
(
q
.
getMessage
())
for
q
in
constraint
.
fixConsistency
(
obj
)])
[
str
(
q
.
getMessage
())
for
q
in
constraint
.
fixConsistency
(
obj
)])
self
.
assertEqual
s
((),
obj
.
_local_properties
)
self
.
assertEqual
((),
obj
.
_local_properties
)
self
.
assertEqual
s
(
1.234
,
obj
.
getLocalProperty
())
self
.
assertEqual
(
1.234
,
obj
.
getLocalProperty
())
obj
.
edit
(
local_property
=
3
)
obj
.
edit
(
local_property
=
3
)
self
.
assertEqual
s
(
3.
,
obj
.
getLocalProperty
())
self
.
assertEqual
(
3.
,
obj
.
getLocalProperty
())
def
test_PropertyTypeValidityFixLocalPropertiesContent
(
self
):
def
test_PropertyTypeValidityFixLocalPropertiesContent
(
self
):
"""Tests PropertyTypeValidity can repairs local property of type content
"""Tests PropertyTypeValidity can repairs local property of type content
...
@@ -1254,7 +1254,7 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1254,7 +1254,7 @@ class TestConstraint(PropertySheetTestCase):
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
.
assertEqual
(
1
,
len
(
obj
.
_local_properties
))
self
.
assertEqual
s
([],
constraint
.
checkConsistency
(
obj
))
self
.
assertEqual
([],
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"
,
portal_type
=
"Acquired Property"
,
portal_type
=
"Acquired Property"
,
...
@@ -1274,8 +1274,8 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1274,8 +1274,8 @@ class TestConstraint(PropertySheetTestCase):
self
.
assertEqual
(
sorted
([
self
.
assertEqual
(
sorted
([
'Property default_organisation_title was migrated from local properties.'
]),
'Property default_organisation_title was migrated from local properties.'
]),
sorted
([
str
(
q
.
getMessage
())
for
q
in
constraint
.
fixConsistency
(
obj
)]))
sorted
([
str
(
q
.
getMessage
())
for
q
in
constraint
.
fixConsistency
(
obj
)]))
self
.
assertEqual
s
(
'foo'
,
obj
.
getDefaultOrganisationTitle
())
self
.
assertEqual
(
'foo'
,
obj
.
getDefaultOrganisationTitle
())
self
.
assertEqual
s
(
'foo'
,
obj
.
default_organisation
.
getTitle
())
self
.
assertEqual
(
'foo'
,
obj
.
default_organisation
.
getTitle
())
self
.
assertEqual
(
0
,
len
(
obj
.
_local_properties
))
self
.
assertEqual
(
0
,
len
(
obj
.
_local_properties
))
finally
:
finally
:
ti
.
_setTypeAllowedContentTypeList
(
allowed_types
)
ti
.
_setTypeAllowedContentTypeList
(
allowed_types
)
...
@@ -1293,7 +1293,7 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1293,7 +1293,7 @@ class TestConstraint(PropertySheetTestCase):
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
.
assertEqual
(
1
,
len
(
obj
.
_local_properties
))
self
.
assertEqual
s
([],
constraint
.
checkConsistency
(
obj
))
self
.
assertEqual
([],
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"
,
...
@@ -1304,7 +1304,7 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1304,7 +1304,7 @@ class TestConstraint(PropertySheetTestCase):
sorted
([
str
(
q
.
getMessage
())
for
q
in
constraint
.
fixConsistency
(
obj
)]))
sorted
([
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
.
assertEqual
(
0
,
len
(
obj
.
_local_properties
))
self
.
assertEqual
s
(
obj
,
obj
.
getTestingCategoryValue
())
self
.
assertEqual
(
obj
,
obj
.
getTestingCategoryValue
())
def
stepCreateContentExistence
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepCreateContentExistence
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
"""
...
@@ -1434,13 +1434,13 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1434,13 +1434,13 @@ class TestConstraint(PropertySheetTestCase):
)
)
consistency_message_list
=
obj
.
checkConsistency
()
consistency_message_list
=
obj
.
checkConsistency
()
self
.
assertEqual
s
(
1
,
len
(
consistency_message_list
))
self
.
assertEqual
(
1
,
len
(
consistency_message_list
))
message
=
consistency_message_list
[
0
]
message
=
consistency_message_list
[
0
]
from
Products.ERP5Type.ConsistencyMessage
import
ConsistencyMessage
from
Products.ERP5Type.ConsistencyMessage
import
ConsistencyMessage
self
.
assertTrue
(
isinstance
(
message
,
ConsistencyMessage
))
self
.
assertTrue
(
isinstance
(
message
,
ConsistencyMessage
))
self
.
assertEqual
s
(
message
.
class_name
,
'Attribute Equality Constraint'
)
self
.
assertEqual
(
message
.
class_name
,
'Attribute Equality Constraint'
)
obj
.
setTitle
(
'a'
)
obj
.
setTitle
(
'a'
)
self
.
assertEqual
s
(
obj
.
checkConsistency
(),
[])
self
.
assertEqual
(
obj
.
checkConsistency
(),
[])
def
test_OverrideMessage
(
self
):
def
test_OverrideMessage
(
self
):
# messages can be overriden in property sheet
# messages can be overriden in property sheet
...
@@ -1458,9 +1458,9 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1458,9 +1458,9 @@ class TestConstraint(PropertySheetTestCase):
)
)
consistency_message_list
=
obj
.
checkConsistency
()
consistency_message_list
=
obj
.
checkConsistency
()
self
.
assertEqual
s
(
1
,
len
(
consistency_message_list
))
self
.
assertEqual
(
1
,
len
(
consistency_message_list
))
message
=
consistency_message_list
[
0
]
message
=
consistency_message_list
[
0
]
self
.
assertEqual
s
(
'Attribute title does not match'
,
self
.
assertEqual
(
'Attribute title does not match'
,
str
(
message
.
getTranslatedMessage
()))
str
(
message
.
getTranslatedMessage
()))
def
test_PropertyTypeValidityWithUnauthorizedCategory
(
self
):
def
test_PropertyTypeValidityWithUnauthorizedCategory
(
self
):
...
@@ -1478,7 +1478,7 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1478,7 +1478,7 @@ class TestConstraint(PropertySheetTestCase):
self
.
_addProperty
(
'Assignment'
,
"UnauthorizedCategory"
,
self
.
_addProperty
(
'Assignment'
,
"UnauthorizedCategory"
,
portal_type
=
"Property Type Validity Constraint"
,
portal_type
=
"Property Type Validity Constraint"
,
property_id
=
"type_check"
)
property_id
=
"type_check"
)
self
.
assertEqual
s
([],
person
.
checkConsistency
())
self
.
assertEqual
([],
person
.
checkConsistency
())
group3
=
self
.
category_tool
.
restrictedTraverse
(
group3
=
self
.
category_tool
.
restrictedTraverse
(
'group/testGroup3'
,
self
.
category_tool
.
group
.
newContent
(
'group/testGroup3'
,
self
.
category_tool
.
group
.
newContent
(
portal_type
=
'Category'
,
portal_type
=
'Category'
,
...
@@ -1491,15 +1491,15 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1491,15 +1491,15 @@ class TestConstraint(PropertySheetTestCase):
# Manager can access testGroup3, so full information is included in
# Manager can access testGroup3, so full information is included in
# the error message.
# the error message.
error_list
=
person
.
checkConsistency
()
error_list
=
person
.
checkConsistency
()
self
.
assertEqual
s
(
1
,
len
(
error_list
))
self
.
assertEqual
(
1
,
len
(
error_list
))
self
.
assertEqual
s
(
"Attribute source_title should be of type string but is of type <type 'int'>"
,
self
.
assertEqual
(
"Attribute source_title should be of type string but is of type <type 'int'>"
,
str
(
error_list
[
0
].
getMessage
()))
str
(
error_list
[
0
].
getMessage
()))
self
.
stepLoginAsAssignee
()
self
.
stepLoginAsAssignee
()
# Assignee cannot access testGroup3, so full information is not
# Assignee cannot access testGroup3, so full information is not
# included in the error message.
# included in the error message.
error_list
=
person
.
checkConsistency
()
error_list
=
person
.
checkConsistency
()
self
.
assertEqual
s
(
1
,
len
(
error_list
))
self
.
assertEqual
(
1
,
len
(
error_list
))
self
.
assertNotEqual
s
(
"Attribute source_title should be of type string but is of type <type 'int'>"
,
self
.
assertNotEqual
(
"Attribute source_title should be of type string but is of type <type 'int'>"
,
str
(
error_list
[
0
].
getMessage
()))
str
(
error_list
[
0
].
getMessage
()))
def
test_PropertyTypeValidityForMultivaluedProperty
(
self
):
def
test_PropertyTypeValidityForMultivaluedProperty
(
self
):
...
@@ -1517,7 +1517,7 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1517,7 +1517,7 @@ class TestConstraint(PropertySheetTestCase):
elementary_type
=
"float"
,
elementary_type
=
"float"
,
multivalued
=
1
)
multivalued
=
1
)
obj
.
edit
(
multi_valuated_property
=
[
1.0
,
2.0
,
3.0
,
])
obj
.
edit
(
multi_valuated_property
=
[
1.0
,
2.0
,
3.0
,
])
self
.
assertEqual
s
([],
constraint
.
checkConsistency
(
obj
))
self
.
assertEqual
([],
constraint
.
checkConsistency
(
obj
))
def
stepValidateObject
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepValidateObject
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment