Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
erp5
Commits
b428b630
Commit
b428b630
authored
Aug 19, 2016
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_catalog: Update testBusinessTemplate according to changes in portal_catalog
parent
acb1e79b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
32 deletions
+41
-32
product/ERP5/tests/testBusinessTemplate.py
product/ERP5/tests/testBusinessTemplate.py
+41
-32
No files found.
product/ERP5/tests/testBusinessTemplate.py
View file @
b428b630
...
@@ -979,9 +979,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -979,9 +979,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
skin_subfolder
=
skin_folder
.
_getOb
(
'erp5_subgeek'
,
None
)
skin_subfolder
=
skin_folder
.
_getOb
(
'erp5_subgeek'
,
None
)
self
.
assertTrue
(
skin_subfolder
is
not
None
)
self
.
assertTrue
(
skin_subfolder
is
not
None
)
method_id
=
"z_fake_method"
method_id
=
"z_fake_method"
addSQLMethod
=
skin_subfolder
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
addSQLMethod
=
skin_subfolder
.
newContent
addSQLMethod
(
id
=
method_id
,
title
=
''
,
connection_id
=
'erp5_sql_connection
'
,
addSQLMethod
(
portal_type
=
'SQL Method'
,
id
=
method_id
,
title
=
'
'
,
arguments
=
''
,
template
=
''
)
connection_id
=
'erp5_sql_connection'
,
arguments
=
''
,
src
=
''
)
zsql_method
=
skin_subfolder
.
_getOb
(
method_id
,
None
)
zsql_method
=
skin_subfolder
.
_getOb
(
method_id
,
None
)
self
.
assertTrue
(
zsql_method
is
not
None
)
self
.
assertTrue
(
zsql_method
is
not
None
)
sequence
.
edit
(
zsql_method_id
=
method_id
)
sequence
.
edit
(
zsql_method_id
=
method_id
)
...
@@ -1584,9 +1584,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1584,9 +1584,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
catalog
=
pc
.
getSQLCatalog
()
catalog
=
pc
.
getSQLCatalog
()
self
.
assertTrue
(
catalog
is
not
None
)
self
.
assertTrue
(
catalog
is
not
None
)
method_id
=
"z_fake_method"
method_id
=
"z_fake_method"
addSQLMethod
=
catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
addSQLMethod
=
catalog
.
newContent
addSQLMethod
(
id
=
method_id
,
title
=
''
,
connection_id
=
'erp5_sql_connection
'
,
addSQLMethod
(
portal_type
=
'SQL Method'
,
id
=
method_id
,
title
=
'
'
,
arguments
=
''
,
template
=
''
)
connection_id
=
'erp5_sql_connection'
,
arguments
=
''
,
src
=
''
)
zsql_method
=
catalog
.
_getOb
(
method_id
,
None
)
zsql_method
=
catalog
.
_getOb
(
method_id
,
None
)
self
.
assertTrue
(
zsql_method
is
not
None
)
self
.
assertTrue
(
zsql_method
is
not
None
)
sequence
.
edit
(
zsql_method_id
=
method_id
)
sequence
.
edit
(
zsql_method_id
=
method_id
)
...
@@ -1598,21 +1598,20 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1598,21 +1598,20 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
# set filter for this method
# set filter for this method
expression
=
'python: context.isPredicate()'
expression
=
'python: context.isPredicate()'
expr_instance
=
Expression
(
expression
)
expr_instance
=
Expression
(
expression
)
catalog
.
filter_dict
[
method_id
]
=
PersistentMapping
()
zsql_method
.
setFiltered
(
1
)
catalog
.
filter_dict
[
method_id
][
'filtered'
]
=
1
zsql_method
.
setExpression
(
expression
)
catalog
.
filter_dict
[
method_id
][
'expression'
]
=
expression
zsql_method
.
setExpressionInstance
(
expr_instance
)
catalog
.
filter_dict
[
method_id
][
'expression_instance'
]
=
expr_instance
zsql_method
.
setExpressionCacheKey
(
'portal_type'
)
catalog
.
filter_dict
[
method_id
][
'expression_cache_key'
]
=
'portal_type'
,
zsql_method
.
setTypeList
([])
catalog
.
filter_dict
[
method_id
][
'type'
]
=
[]
def
stepCreateUpdateCatalogMethod
(
self
,
sequence
=
None
,
**
kw
):
def
stepCreateUpdateCatalogMethod
(
self
,
sequence
=
None
,
**
kw
):
pc
=
self
.
getCatalogTool
()
pc
=
self
.
getCatalogTool
()
catalog
=
pc
.
getSQLCatalog
()
catalog
=
pc
.
getSQLCatalog
()
self
.
assertTrue
(
catalog
is
not
None
)
self
.
assertTrue
(
catalog
is
not
None
)
method_id
=
"z_fake_method"
method_id
=
"z_fake_method"
addSQLMethod
=
catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
addSQLMethod
=
catalog
.
newContent
addSQLMethod
(
id
=
method_id
,
title
=
''
,
connection_id
=
'erp5_sql_connection
'
,
addSQLMethod
(
portal_type
=
'SQL Method'
,
id
=
method_id
,
title
=
'
'
,
arguments
=
''
,
template
=
''
)
connection_id
=
'erp5_sql_connection'
,
arguments
=
''
,
src
=
''
)
zsql_method
=
catalog
.
_getOb
(
method_id
,
None
)
zsql_method
=
catalog
.
_getOb
(
method_id
,
None
)
self
.
assertTrue
(
zsql_method
is
not
None
)
self
.
assertTrue
(
zsql_method
is
not
None
)
sequence
.
edit
(
zsql_method_id
=
method_id
)
sequence
.
edit
(
zsql_method_id
=
method_id
)
...
@@ -1624,20 +1623,19 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1624,20 +1623,19 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
# set filter for this method
# set filter for this method
expression
=
'python: context.isDelivery()'
expression
=
'python: context.isDelivery()'
expr_instance
=
Expression
(
expression
)
expr_instance
=
Expression
(
expression
)
catalog
.
filter_dict
[
method_id
]
=
PersistentMapping
()
zsql_method
.
setFiltered
(
1
)
catalog
.
filter_dict
[
method_id
][
'filtered'
]
=
1
zsql_method
.
setExpression
(
expression
)
catalog
.
filter_dict
[
method_id
][
'expression'
]
=
expression
zsql_method
.
setExpressionInstance
(
expr_instance
)
catalog
.
filter_dict
[
method_id
][
'expression_instance'
]
=
expr_instance
zsql_method
.
setExpressionCacheKey
(
'portal_type'
)
catalog
.
filter_dict
[
method_id
][
'expression_cache_key'
]
=
'portal_type'
,
zsql_method
.
setTypeList
([])
catalog
.
filter_dict
[
method_id
][
'type'
]
=
[]
def
stepCreateNewCatalogMethod
(
self
,
sequence
=
None
,
**
kw
):
def
stepCreateNewCatalogMethod
(
self
,
sequence
=
None
,
**
kw
):
pc
=
self
.
getCatalogTool
()
pc
=
self
.
getCatalogTool
()
catalog
=
pc
.
getSQLCatalog
()
catalog
=
pc
.
getSQLCatalog
()
method_id
=
"z_another_fake_method"
method_id
=
"z_another_fake_method"
addSQLMethod
=
catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
addSQLMethod
=
catalog
.
newContent
addSQLMethod
(
id
=
method_id
,
title
=
''
,
connection_id
=
'erp5_sql_connection
'
,
addSQLMethod
(
portal_type
=
'SQL Method'
,
id
=
method_id
,
title
=
'
'
,
arguments
=
''
,
template
=
''
)
connection_id
=
'erp5_sql_connection'
,
arguments
=
''
,
src
=
''
)
zsql_method
=
catalog
.
_getOb
(
method_id
,
None
)
zsql_method
=
catalog
.
_getOb
(
method_id
,
None
)
self
.
assertTrue
(
zsql_method
is
not
None
)
self
.
assertTrue
(
zsql_method
is
not
None
)
sequence
.
edit
(
another_zsql_method_id
=
method_id
)
sequence
.
edit
(
another_zsql_method_id
=
method_id
)
...
@@ -1716,11 +1714,17 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1716,11 +1714,17 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
# check catalog properties
# check catalog properties
self
.
assertIn
(
method_id
,
catalog
.
sql_uncatalog_object
)
self
.
assertIn
(
method_id
,
catalog
.
sql_uncatalog_object
)
# check filter
# check filter
if
catalog
.
meta_type
==
'ERP5 Catalog'
:
filter_dict
=
catalog
.
getFilterDict
()
filter_dict
=
filter_dict
[
method_id
]
self
.
assertEqual
(
filter_dict
[
'expression_cache_key'
],
[
'portal_type'
])
self
.
assertEqual
(
filter_dict
[
'type'
],
[])
elif
catalog
.
meta_type
==
'SQLCatalog'
:
filter_dict
=
catalog
.
filter_dict
[
method_id
]
filter_dict
=
catalog
.
filter_dict
[
method_id
]
self
.
assertEqual
(
filter_dict
[
'filtered'
],
1
)
self
.
assertEqual
(
filter_dict
[
'expression'
],
'python: context.isPredicate()'
)
self
.
assertEqual
(
filter_dict
[
'expression_cache_key'
],
(
'portal_type'
,))
self
.
assertEqual
(
filter_dict
[
'expression_cache_key'
],
(
'portal_type'
,))
self
.
assertEqual
(
filter_dict
[
'type'
],
())
self
.
assertEqual
(
filter_dict
[
'type'
],
())
self
.
assertEqual
(
filter_dict
[
'filtered'
],
1
)
self
.
assertEqual
(
filter_dict
[
'expression'
],
'python: context.isPredicate()'
)
def
stepCheckUpdatedCatalogMethodExists
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckUpdatedCatalogMethodExists
(
self
,
sequence
=
None
,
**
kw
):
pc
=
self
.
getCatalogTool
()
pc
=
self
.
getCatalogTool
()
...
@@ -1732,11 +1736,17 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1732,11 +1736,17 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
# check catalog properties
# check catalog properties
self
.
assertIn
(
method_id
,
catalog
.
sql_uncatalog_object
)
self
.
assertIn
(
method_id
,
catalog
.
sql_uncatalog_object
)
# check filter
# check filter
if
catalog
.
meta_type
==
'ERP5 Catalog'
:
filter_dict
=
catalog
.
getFilterDict
()
filter_dict
=
filter_dict
[
method_id
]
self
.
assertEqual
(
filter_dict
[
'expression_cache_key'
],
[
'portal_type'
])
self
.
assertEqual
(
filter_dict
[
'type'
],
[])
elif
catalog
.
meta_type
==
'SQLCatalog'
:
filter_dict
=
catalog
.
filter_dict
[
method_id
]
filter_dict
=
catalog
.
filter_dict
[
method_id
]
self
.
assertEqual
(
filter_dict
[
'filtered'
],
1
)
self
.
assertEqual
(
filter_dict
[
'expression'
],
'python: context.isDelivery()'
)
self
.
assertEqual
(
filter_dict
[
'expression_cache_key'
],
(
'portal_type'
,))
self
.
assertEqual
(
filter_dict
[
'expression_cache_key'
],
(
'portal_type'
,))
self
.
assertEqual
(
filter_dict
[
'type'
],
())
self
.
assertEqual
(
filter_dict
[
'type'
],
())
self
.
assertEqual
(
filter_dict
[
'filtered'
],
1
)
self
.
assertEqual
(
filter_dict
[
'expression'
],
'python: context.isDelivery()'
)
def
stepCheckCatalogMethodRemoved
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckCatalogMethodRemoved
(
self
,
sequence
=
None
,
**
kw
):
"""
"""
...
@@ -1771,8 +1781,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1771,8 +1781,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
catalog
.
sql_uncatalog_object
=
tuple
(
sql_uncatalog_object
)
catalog
.
sql_uncatalog_object
=
tuple
(
sql_uncatalog_object
)
self
.
assertNotIn
(
method_id
,
catalog
.
sql_uncatalog_object
)
self
.
assertNotIn
(
method_id
,
catalog
.
sql_uncatalog_object
)
# remove filter
# remove filter
del
catalog
.
filter_dict
[
method_id
]
self
.
assertNotIn
(
method_id
,
catalog
.
getFilterDict
().
keys
())
self
.
assertNotIn
(
method_id
,
catalog
.
filter_dict
.
keys
())
# Related key, Result key and table, and others
# Related key, Result key and table, and others
def
stepCreateKeysAndTable
(
self
,
sequence
=
list
,
**
kw
):
def
stepCreateKeysAndTable
(
self
,
sequence
=
list
,
**
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