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
Titouan Soulard
erp5
Commits
342f85b7
Commit
342f85b7
authored
4 years ago
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZODB Components: erp5_core_test: Migrate Unit Tests.
parent
b22b277f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
243 additions
and
21 deletions
+243
-21
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFieldValueCache.py
...teItem/portal_components/test.erp5.testFieldValueCache.py
+4
-4
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFieldValueCache.xml
...eItem/portal_components/test.erp5.testFieldValueCache.xml
+110
-0
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFields.py
...estTemplateItem/portal_components/test.erp5.testFields.py
+15
-16
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFields.xml
...stTemplateItem/portal_components/test.erp5.testFields.xml
+110
-0
bt5/erp5_core_test/bt/dependency_list
bt5/erp5_core_test/bt/dependency_list
+2
-1
bt5/erp5_core_test/bt/template_test_id_list
bt5/erp5_core_test/bt/template_test_id_list
+2
-0
No files found.
product/ERP5Form/tests/
testFieldValueCache.py
→
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.
testFieldValueCache.py
View file @
342f85b7
...
@@ -66,16 +66,16 @@ class TestFieldValueCache(ERP5TypeTestCase):
...
@@ -66,16 +66,16 @@ class TestFieldValueCache(ERP5TypeTestCase):
form
()
form
()
# Get form value
# Get form value
field
=
form
.
my_first_name
field
=
form
.
my_first_name
id
=
'title'
id
_
=
'title'
from
Products.ERP5Form.Form
import
field_value_cache
from
Products.ERP5Form.Form
import
field_value_cache
cache_id
=
(
'ProxyField.get_value'
,
cache_id
=
(
'ProxyField.get_value'
,
field
.
_p_oid
,
field
.
_p_oid
,
field
.
_p_oid
,
field
.
_p_oid
,
id
)
id
_
)
# Make sure cache has field
# Make sure cache has field
self
.
assertTrue
(
field_value_cache
.
has_key
(
cache_id
))
self
.
assertTrue
(
field_value_cache
.
has_key
(
cache_id
))
# Make sure cache and field are equal
# Make sure cache and field are equal
self
.
assertEqual
(
field
.
get_value
(
id
),
field_value_cache
[
cache_id
])
self
.
assertEqual
(
field
.
get_value
(
id
_
),
field_value_cache
[
cache_id
])
# Call manage_renameObject
# Call manage_renameObject
form
.
manage_renameObject
(
'my_first_name'
,
'my_first_name2'
)
form
.
manage_renameObject
(
'my_first_name'
,
'my_first_name2'
)
form
.
manage_renameObject
(
'my_first_name2'
,
'my_first_name'
)
form
.
manage_renameObject
(
'my_first_name2'
,
'my_first_name'
)
...
@@ -86,4 +86,4 @@ class TestFieldValueCache(ERP5TypeTestCase):
...
@@ -86,4 +86,4 @@ class TestFieldValueCache(ERP5TypeTestCase):
# Make sure cache has field
# Make sure cache has field
self
.
assertTrue
(
field_value_cache
.
has_key
(
cache_id
))
self
.
assertTrue
(
field_value_cache
.
has_key
(
cache_id
))
# Make sure cache and field are equal
# Make sure cache and field are equal
self
.
assertEqual
(
field
.
get_value
(
id
),
field_value_cache
[
cache_id
])
self
.
assertEqual
(
field
.
get_value
(
id
_
),
field_value_cache
[
cache_id
])
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFieldValueCache.xml
0 → 100644
View file @
342f85b7
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testFieldValueCache
</string>
</value>
</item>
<item>
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5Form.tests.testFieldValueCache
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testFieldValueCache
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</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>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
This diff is collapsed.
Click to expand it.
product/ERP5Form/tests/
testFields.py
→
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.
testFields.py
View file @
342f85b7
...
@@ -34,13 +34,12 @@ import unittest
...
@@ -34,13 +34,12 @@ import unittest
# Initialize ERP5Form Product to load monkey patches
# Initialize ERP5Form Product to load monkey patches
from
Acquisition
import
aq_base
from
Products.Formulator.FieldRegistry
import
FieldRegistry
from
Products.Formulator.FieldRegistry
import
FieldRegistry
from
Products.Formulator.Validator
import
ValidationError
from
Products.Formulator.Validator
import
ValidationError
from
Products.Formulator.StandardFields
import
FloatField
,
StringField
,
\
from
Products.Formulator.StandardFields
import
FloatField
,
StringField
,
\
DateTimeField
,
TextAreaField
,
CheckBoxField
,
ListField
,
LinesField
,
\
DateTimeField
,
TextAreaField
,
CheckBoxField
,
ListField
,
LinesField
,
\
MultiListField
,
IntegerField
MultiListField
,
IntegerField
from
Products.Formulator.MethodField
import
Method
,
BoundMethod
from
Products.Formulator.MethodField
import
Method
from
Products.Formulator.TALESField
import
TALESMethod
from
Products.Formulator.TALESField
import
TALESMethod
from
Products.ERP5Type.Core.Folder
import
Folder
from
Products.ERP5Type.Core.Folder
import
Folder
...
@@ -61,7 +60,7 @@ class TestRenderViewAPI(ERP5TypeTestCase):
...
@@ -61,7 +60,7 @@ class TestRenderViewAPI(ERP5TypeTestCase):
return
"{Field,Widget}.render_view"
return
"{Field,Widget}.render_view"
def
test_signature
(
self
):
def
test_signature
(
self
):
for
field
in
FieldRegistry
.
get_field_classes
().
itervalues
():
for
field
in
FieldRegistry
.
get_field_classes
().
itervalues
():
# pylint: disable=no-value-for-parameter
self
.
assertEqual
((
'self'
,
'value'
,
'REQUEST'
,
'render_prefix'
),
self
.
assertEqual
((
'self'
,
'value'
,
'REQUEST'
,
'render_prefix'
),
field
.
render_view
.
im_func
.
func_code
.
co_varnames
)
field
.
render_view
.
im_func
.
func_code
.
co_varnames
)
if
field
is
not
ProxyField
.
ProxyField
:
if
field
is
not
ProxyField
.
ProxyField
:
...
@@ -643,9 +642,9 @@ class TestProxyField(ERP5TypeTestCase):
...
@@ -643,9 +642,9 @@ class TestProxyField(ERP5TypeTestCase):
_setUpDefaultTraversable
()
_setUpDefaultTraversable
()
def
addField
(
self
,
form
,
id
,
title
,
field_type
):
def
addField
(
self
,
form
,
id
_
,
title
,
field_type
):
form
.
manage_addField
(
id
,
title
,
field_type
)
form
.
manage_addField
(
id
_
,
title
,
field_type
)
field
=
getattr
(
form
,
id
)
field
=
getattr
(
form
,
id
_
)
field
.
_p_oid
=
makeDummyOid
()
field
.
_p_oid
=
makeDummyOid
()
return
field
return
field
...
@@ -692,8 +691,8 @@ class TestProxyField(ERP5TypeTestCase):
...
@@ -692,8 +691,8 @@ class TestProxyField(ERP5TypeTestCase):
def
test_get_value_default
(
self
):
def
test_get_value_default
(
self
):
# If the proxy field is named 'my_id', it will get 'id'
# If the proxy field is named 'my_id', it will get 'id'
# property on the context, regardless of the id of the proxified field
# property on the context, regardless of the id of the proxified field
original_field
=
self
.
addField
(
self
.
container
.
Base_viewProxyFieldLibrary
,
self
.
addField
(
self
.
container
.
Base_viewProxyFieldLibrary
,
'my_title'
,
'Title'
,
'StringField'
)
'my_title'
,
'Title'
,
'StringField'
)
proxy_field
=
self
.
addField
(
self
.
container
.
Base_view
,
proxy_field
=
self
.
addField
(
self
.
container
.
Base_view
,
'my_id'
,
'ID'
,
'ProxyField'
)
'my_id'
,
'ID'
,
'ProxyField'
)
proxy_field
.
manage_edit_xmlrpc
(
dict
(
form_id
=
'Base_viewProxyFieldLibrary'
,
proxy_field
.
manage_edit_xmlrpc
(
dict
(
form_id
=
'Base_viewProxyFieldLibrary'
,
...
@@ -789,8 +788,8 @@ class TestProxyField(ERP5TypeTestCase):
...
@@ -789,8 +788,8 @@ class TestProxyField(ERP5TypeTestCase):
def
test_manage_edit_surcharged_xmlrpc
(
self
):
def
test_manage_edit_surcharged_xmlrpc
(
self
):
# manage_edit_surcharged_xmlrpc is a method to edit proxyfields
# manage_edit_surcharged_xmlrpc is a method to edit proxyfields
# programmatically
# programmatically
original_field
=
self
.
addField
(
self
.
container
.
Base_viewProxyFieldLibrary
,
self
.
addField
(
self
.
container
.
Base_viewProxyFieldLibrary
,
'my_string'
,
'String'
,
'StringField'
)
'my_string'
,
'String'
,
'StringField'
)
proxy_field
=
self
.
addField
(
self
.
container
.
Base_view
,
proxy_field
=
self
.
addField
(
self
.
container
.
Base_view
,
'my_String'
,
''
,
'ProxyField'
)
'my_String'
,
''
,
'ProxyField'
)
proxy_field
.
manage_edit_xmlrpc
(
dict
(
form_id
=
'Base_viewProxyFieldLibrary'
,
proxy_field
.
manage_edit_xmlrpc
(
dict
(
form_id
=
'Base_viewProxyFieldLibrary'
,
...
@@ -809,8 +808,8 @@ class TestProxyField(ERP5TypeTestCase):
...
@@ -809,8 +808,8 @@ class TestProxyField(ERP5TypeTestCase):
"""
"""
Test a case that if proxy field id is same as template field id.
Test a case that if proxy field id is same as template field id.
"""
"""
original_field
=
self
.
addField
(
self
.
container
.
Base_viewProxyFieldLibrary
,
self
.
addField
(
self
.
container
.
Base_viewProxyFieldLibrary
,
'my_string'
,
'String'
,
'StringField'
)
'my_string'
,
'String'
,
'StringField'
)
# Use different id to the template field.
# Use different id to the template field.
proxy_field2
=
self
.
addField
(
self
.
container
.
Base_view
,
proxy_field2
=
self
.
addField
(
self
.
container
.
Base_view
,
'my_another_string'
,
''
,
'ProxyField'
)
'my_another_string'
,
''
,
'ProxyField'
)
...
@@ -842,8 +841,8 @@ class TestProxyField(ERP5TypeTestCase):
...
@@ -842,8 +841,8 @@ class TestProxyField(ERP5TypeTestCase):
not surcharged.
not surcharged.
"""
"""
# create a field
# create a field
original_field
=
self
.
addField
(
self
.
container
.
Base_viewProxyFieldLibrary
,
self
.
addField
(
self
.
container
.
Base_viewProxyFieldLibrary
,
'my_title'
,
'OrigTitle'
,
'StringField'
)
'my_title'
,
'OrigTitle'
,
'StringField'
)
field
=
self
.
addField
(
self
.
container
.
Base_view
,
field
=
self
.
addField
(
self
.
container
.
Base_view
,
'my_dict_test'
,
''
,
'ProxyField'
)
'my_dict_test'
,
''
,
'ProxyField'
)
field
.
manage_edit_xmlrpc
(
dict
(
form_id
=
'Base_viewProxyFieldLibrary'
,
field
.
manage_edit_xmlrpc
(
dict
(
form_id
=
'Base_viewProxyFieldLibrary'
,
...
@@ -961,9 +960,9 @@ class TestFieldValueCache(ERP5TypeTestCase):
...
@@ -961,9 +960,9 @@ class TestFieldValueCache(ERP5TypeTestCase):
def
test_method_field
(
self
):
def
test_method_field
(
self
):
field
=
self
.
root
.
form
.
field
field
=
self
.
root
.
form
.
field
value
,
cacheable
=
getFieldValue
(
field
,
field
,
'external_validator'
)
value
,
_
=
getFieldValue
(
field
,
field
,
'external_validator'
)
self
.
assertEqual
(
False
,
value
.
value
is
field
.
values
[
'external_validator'
])
self
.
assertEqual
(
False
,
value
.
value
is
field
.
values
[
'external_validator'
])
self
.
assertEqual
(
True
,
type
(
value
.
value
)
is
Method
)
self
.
assertEqual
(
True
,
isinstance
(
value
.
value
,
Method
)
)
def
_getCacheSize
(
self
,
cache_id
):
def
_getCacheSize
(
self
,
cache_id
):
count
=
0
count
=
0
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFields.xml
0 → 100644
View file @
342f85b7
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testFields
</string>
</value>
</item>
<item>
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5Form.tests.testFields
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testFields
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</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>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/bt/dependency_list
View file @
342f85b7
erp5_full_text_mroonga_catalog
erp5_full_text_mroonga_catalog
erp5_base
erp5_base
erp5_csv_style
erp5_csv_style
\ No newline at end of file
erp5_core_proxy_field_legacy
\ No newline at end of file
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/bt/template_test_id_list
View file @
342f85b7
...
@@ -17,6 +17,8 @@ test.erp5.testERP5Base
...
@@ -17,6 +17,8 @@ test.erp5.testERP5Base
test.erp5.testERP5Category
test.erp5.testERP5Category
test.erp5.testERP5Coordinate
test.erp5.testERP5Coordinate
test.erp5.testERP5Core
test.erp5.testERP5Core
test.erp5.testFieldValueCache
test.erp5.testFields
test.erp5.testFolder
test.erp5.testFolder
test.erp5.testFolderMigration
test.erp5.testFolderMigration
test.erp5.testGeographicalAddress
test.erp5.testGeographicalAddress
...
...
This diff is collapsed.
Click to expand it.
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