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
Labels
Merge Requests
143
Merge Requests
143
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
2785a5cc
Commit
2785a5cc
authored
Oct 26, 2015
by
Jérome Perrin
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testBusinessTemplate: use better assert methods (assertIn)
parent
382ab989
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
115 additions
and
115 deletions
+115
-115
product/ERP5/tests/testBusinessTemplate.py
product/ERP5/tests/testBusinessTemplate.py
+115
-115
No files found.
product/ERP5/tests/testBusinessTemplate.py
View file @
2785a5cc
...
@@ -399,17 +399,17 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -399,17 +399,17 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
skins_tool
=
self
.
getSkinsTool
()
skins_tool
=
self
.
getSkinsTool
()
for
skin_name
,
selection
in
skins_tool
.
getSkinPaths
():
for
skin_name
,
selection
in
skins_tool
.
getSkinPaths
():
if
skin_name
==
'View'
:
if
skin_name
==
'View'
:
self
.
assert
False
(
'erp5_csv_style'
in
selection
)
self
.
assert
NotIn
(
'erp5_csv_style'
,
selection
)
self
.
assert
False
(
'erp5_core'
not
in
selection
)
self
.
assert
In
(
'erp5_core'
,
selection
)
self
.
assert
False
(
'erp5_xhtml_style'
not
in
selection
)
self
.
assert
In
(
'erp5_xhtml_style'
,
selection
)
if
skin_name
==
'Print'
:
if
skin_name
==
'Print'
:
self
.
assert
False
(
'erp5_xhtml_style'
in
selection
)
self
.
assert
In
(
'erp5_xhtml_style'
,
selection
)
self
.
assert
False
(
'erp5_csv_style'
in
selection
)
self
.
assert
In
(
'erp5_csv_style'
,
selection
)
self
.
assert
False
(
'erp5_core'
not
in
selection
)
self
.
assert
NotIn
(
'erp5_core'
,
selection
)
if
skin_name
==
'CSV'
:
if
skin_name
==
'CSV'
:
self
.
assert
False
(
'erp5_xhtml_style'
in
selection
)
self
.
assert
NotIn
(
'erp5_xhtml_style'
,
selection
)
self
.
assert
False
(
'erp5_core'
not
in
selection
)
self
.
assert
In
(
'erp5_core'
,
selection
)
self
.
assert
False
(
'erp5_csv_style'
not
in
selection
)
self
.
assert
In
(
'erp5_csv_style'
,
selection
)
def
stepCheckNoTrashBin
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckNoTrashBin
(
self
,
sequence
=
None
,
**
kw
):
"""
"""
...
@@ -436,7 +436,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -436,7 +436,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
trash_ids
=
list
(
trash
.
objectIds
())
trash_ids
=
list
(
trash
.
objectIds
())
self
.
assertEqual
(
len
(
trash
.
objectIds
()),
1
)
self
.
assertEqual
(
len
(
trash
.
objectIds
()),
1
)
bt_id
=
sequence
.
get
(
'import_bt'
).
getId
()
bt_id
=
sequence
.
get
(
'import_bt'
).
getId
()
self
.
assert
True
(
bt_id
not
in
trash_ids
[
0
])
self
.
assert
NotIn
(
bt_id
,
trash_ids
[
0
])
# portal types
# portal types
def
stepCreatePortalType
(
self
,
sequence
=
None
,
**
kw
):
def
stepCreatePortalType
(
self
,
sequence
=
None
,
**
kw
):
...
@@ -1528,7 +1528,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1528,7 +1528,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
object_id
=
sequence
.
get
(
'object_ptype_id'
)
object_id
=
sequence
.
get
(
'object_ptype_id'
)
object_pt
=
pt
.
_getOb
(
object_id
)
object_pt
=
pt
.
_getOb
(
object_id
)
action_id
=
sequence
.
get
(
'first_action_id'
)
action_id
=
sequence
.
get
(
'first_action_id'
)
self
.
assert
True
(
action_id
in
[
x
.
getReference
()
self
.
assert
In
(
action_id
,
[
x
.
getReference
()
for
x
in
object_pt
.
getActionInformationList
()])
for
x
in
object_pt
.
getActionInformationList
()])
def
stepCheckFirstActionNotExists
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckFirstActionNotExists
(
self
,
sequence
=
None
,
**
kw
):
...
@@ -1539,7 +1539,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1539,7 +1539,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
object_id
=
sequence
.
get
(
'object_ptype_id'
)
object_id
=
sequence
.
get
(
'object_ptype_id'
)
object_pt
=
pt
.
_getOb
(
object_id
)
object_pt
=
pt
.
_getOb
(
object_id
)
action_id
=
sequence
.
get
(
'first_action_id'
)
action_id
=
sequence
.
get
(
'first_action_id'
)
self
.
assert
False
(
action_id
in
[
x
.
getReference
()
self
.
assert
NotIn
(
action_id
,
[
x
.
getReference
()
for
x
in
object_pt
.
getActionInformationList
()])
for
x
in
object_pt
.
getActionInformationList
()])
def
stepCheckSecondActionExists
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckSecondActionExists
(
self
,
sequence
=
None
,
**
kw
):
...
@@ -1550,7 +1550,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1550,7 +1550,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
object_id
=
sequence
.
get
(
'object_ptype_id'
)
object_id
=
sequence
.
get
(
'object_ptype_id'
)
object_pt
=
pt
.
_getOb
(
object_id
)
object_pt
=
pt
.
_getOb
(
object_id
)
action_id
=
sequence
.
get
(
'second_action_id'
)
action_id
=
sequence
.
get
(
'second_action_id'
)
self
.
assert
True
(
action_id
in
[
x
.
getReference
()
self
.
assert
In
(
action_id
,
[
x
.
getReference
()
for
x
in
object_pt
.
getActionInformationList
()])
for
x
in
object_pt
.
getActionInformationList
()])
def
stepCheckSecondActionNotExists
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckSecondActionNotExists
(
self
,
sequence
=
None
,
**
kw
):
...
@@ -1561,7 +1561,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1561,7 +1561,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
object_id
=
sequence
.
get
(
'object_ptype_id'
)
object_id
=
sequence
.
get
(
'object_ptype_id'
)
object_pt
=
pt
.
_getOb
(
object_id
)
object_pt
=
pt
.
_getOb
(
object_id
)
action_id
=
sequence
.
get
(
'second_action_id'
)
action_id
=
sequence
.
get
(
'second_action_id'
)
self
.
assert
False
(
action_id
in
[
x
.
getReference
()
self
.
assert
NotIn
(
action_id
,
[
x
.
getReference
()
for
x
in
object_pt
.
getActionInformationList
()])
for
x
in
object_pt
.
getActionInformationList
()])
def
stepAddSecondActionToBusinessTemplate
(
self
,
sequence
=
None
,
**
kw
):
def
stepAddSecondActionToBusinessTemplate
(
self
,
sequence
=
None
,
**
kw
):
...
@@ -1713,7 +1713,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1713,7 +1713,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
zsql_method
=
catalog
.
_getOb
(
method_id
,
None
)
zsql_method
=
catalog
.
_getOb
(
method_id
,
None
)
self
.
assertNotEqual
(
zsql_method
,
None
)
self
.
assertNotEqual
(
zsql_method
,
None
)
# check catalog properties
# check catalog properties
self
.
assert
True
(
method_id
in
catalog
.
sql_uncatalog_object
)
self
.
assert
In
(
method_id
,
catalog
.
sql_uncatalog_object
)
# check filter
# check filter
filter_dict
=
catalog
.
filter_dict
[
method_id
]
filter_dict
=
catalog
.
filter_dict
[
method_id
]
self
.
assertEqual
(
filter_dict
[
'filtered'
],
1
)
self
.
assertEqual
(
filter_dict
[
'filtered'
],
1
)
...
@@ -1729,7 +1729,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1729,7 +1729,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
zsql_method
=
catalog
.
_getOb
(
method_id
,
None
)
zsql_method
=
catalog
.
_getOb
(
method_id
,
None
)
self
.
assertNotEqual
(
zsql_method
,
None
)
self
.
assertNotEqual
(
zsql_method
,
None
)
# check catalog properties
# check catalog properties
self
.
assert
True
(
method_id
in
catalog
.
sql_uncatalog_object
)
self
.
assert
In
(
method_id
,
catalog
.
sql_uncatalog_object
)
# check filter
# check filter
filter_dict
=
catalog
.
filter_dict
[
method_id
]
filter_dict
=
catalog
.
filter_dict
[
method_id
]
self
.
assertEqual
(
filter_dict
[
'filtered'
],
1
)
self
.
assertEqual
(
filter_dict
[
'filtered'
],
1
)
...
@@ -1748,9 +1748,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1748,9 +1748,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
zsql_method
=
catalog
.
_getOb
(
method_id
,
None
)
zsql_method
=
catalog
.
_getOb
(
method_id
,
None
)
self
.
assertTrue
(
zsql_method
is
None
)
self
.
assertTrue
(
zsql_method
is
None
)
# check catalog properties
# check catalog properties
self
.
assert
True
(
method_id
not
in
catalog
.
sql_uncatalog_object
)
self
.
assert
NotIn
(
method_id
,
catalog
.
sql_uncatalog_object
)
# check filter
# check filter
self
.
assert
True
(
method_id
not
in
catalog
.
filter_dict
.
keys
())
self
.
assert
NotIn
(
method_id
,
catalog
.
filter_dict
.
keys
())
def
stepRemoveCatalogMethod
(
self
,
sequence
=
None
,
**
kw
):
def
stepRemoveCatalogMethod
(
self
,
sequence
=
None
,
**
kw
):
"""
"""
...
@@ -1768,10 +1768,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1768,10 +1768,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
sql_uncatalog_object
.
remove
(
method_id
)
sql_uncatalog_object
.
remove
(
method_id
)
sql_uncatalog_object
.
sort
()
sql_uncatalog_object
.
sort
()
catalog
.
sql_uncatalog_object
=
tuple
(
sql_uncatalog_object
)
catalog
.
sql_uncatalog_object
=
tuple
(
sql_uncatalog_object
)
self
.
assert
True
(
method_id
not
in
catalog
.
sql_uncatalog_object
)
self
.
assert
NotIn
(
method_id
,
catalog
.
sql_uncatalog_object
)
# remove filter
# remove filter
del
catalog
.
filter_dict
[
method_id
]
del
catalog
.
filter_dict
[
method_id
]
self
.
assert
True
(
method_id
not
in
catalog
.
filter_dict
.
keys
())
self
.
assert
NotIn
(
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
):
...
@@ -1799,84 +1799,84 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1799,84 +1799,84 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
sql_search_tables
.
append
(
result_table
)
sql_search_tables
.
append
(
result_table
)
sql_search_tables
.
sort
()
sql_search_tables
.
sort
()
catalog
.
sql_search_tables
=
tuple
(
sql_search_tables
)
catalog
.
sql_search_tables
=
tuple
(
sql_search_tables
)
self
.
assert
True
(
result_table
in
catalog
.
sql_search_tables
)
self
.
assert
In
(
result_table
,
catalog
.
sql_search_tables
)
# result key
# result key
if
result_key
not
in
catalog
.
sql_search_result_keys
:
if
result_key
not
in
catalog
.
sql_search_result_keys
:
sql_search_result_keys
=
list
(
catalog
.
sql_search_result_keys
)
sql_search_result_keys
=
list
(
catalog
.
sql_search_result_keys
)
sql_search_result_keys
.
append
(
result_key
)
sql_search_result_keys
.
append
(
result_key
)
sql_search_result_keys
.
sort
()
sql_search_result_keys
.
sort
()
catalog
.
sql_search_result_keys
=
tuple
(
sql_search_result_keys
)
catalog
.
sql_search_result_keys
=
tuple
(
sql_search_result_keys
)
self
.
assert
True
(
result_key
in
catalog
.
sql_search_result_keys
)
self
.
assert
In
(
result_key
,
catalog
.
sql_search_result_keys
)
# related key
# related key
if
related_key
not
in
catalog
.
sql_catalog_related_keys
:
if
related_key
not
in
catalog
.
sql_catalog_related_keys
:
sql_search_related_keys
=
list
(
catalog
.
sql_catalog_related_keys
)
sql_search_related_keys
=
list
(
catalog
.
sql_catalog_related_keys
)
sql_search_related_keys
.
append
(
related_key
)
sql_search_related_keys
.
append
(
related_key
)
sql_search_related_keys
.
sort
()
sql_search_related_keys
.
sort
()
catalog
.
sql_catalog_related_keys
=
tuple
(
sql_search_related_keys
)
catalog
.
sql_catalog_related_keys
=
tuple
(
sql_search_related_keys
)
self
.
assert
True
(
related_key
in
catalog
.
sql_catalog_related_keys
)
self
.
assert
In
(
related_key
,
catalog
.
sql_catalog_related_keys
)
# search keys
# search keys
if
search_key
not
in
catalog
.
sql_catalog_search_keys
:
if
search_key
not
in
catalog
.
sql_catalog_search_keys
:
sql_catalog_search_keys
=
list
(
catalog
.
sql_catalog_search_keys
)
sql_catalog_search_keys
=
list
(
catalog
.
sql_catalog_search_keys
)
sql_catalog_search_keys
.
append
(
search_key
)
sql_catalog_search_keys
.
append
(
search_key
)
sql_catalog_search_keys
.
sort
()
sql_catalog_search_keys
.
sort
()
catalog
.
sql_catalog_search_keys
=
tuple
(
sql_catalog_search_keys
)
catalog
.
sql_catalog_search_keys
=
tuple
(
sql_catalog_search_keys
)
self
.
assert
True
(
search_key
in
catalog
.
sql_catalog_search_keys
)
self
.
assert
In
(
search_key
,
catalog
.
sql_catalog_search_keys
)
# keyword keys
# keyword keys
if
keyword_key
not
in
catalog
.
sql_catalog_keyword_search_keys
:
if
keyword_key
not
in
catalog
.
sql_catalog_keyword_search_keys
:
sql_catalog_keyword_keys
=
list
(
catalog
.
sql_catalog_keyword_search_keys
)
sql_catalog_keyword_keys
=
list
(
catalog
.
sql_catalog_keyword_search_keys
)
sql_catalog_keyword_keys
.
append
(
keyword_key
)
sql_catalog_keyword_keys
.
append
(
keyword_key
)
sql_catalog_keyword_keys
.
sort
()
sql_catalog_keyword_keys
.
sort
()
catalog
.
sql_catalog_keyword_search_keys
=
tuple
(
sql_catalog_keyword_keys
)
catalog
.
sql_catalog_keyword_search_keys
=
tuple
(
sql_catalog_keyword_keys
)
self
.
assert
True
(
keyword_key
in
catalog
.
sql_catalog_keyword_search_keys
)
self
.
assert
In
(
keyword_key
,
catalog
.
sql_catalog_keyword_search_keys
)
# full_text keys
# full_text keys
if
full_text_key
not
in
catalog
.
sql_catalog_full_text_search_keys
:
if
full_text_key
not
in
catalog
.
sql_catalog_full_text_search_keys
:
sql_catalog_full_text_keys
=
list
(
catalog
.
sql_catalog_full_text_search_keys
)
sql_catalog_full_text_keys
=
list
(
catalog
.
sql_catalog_full_text_search_keys
)
sql_catalog_full_text_keys
.
append
(
full_text_key
)
sql_catalog_full_text_keys
.
append
(
full_text_key
)
sql_catalog_full_text_keys
.
sort
()
sql_catalog_full_text_keys
.
sort
()
catalog
.
sql_catalog_full_text_search_keys
=
tuple
(
sql_catalog_full_text_keys
)
catalog
.
sql_catalog_full_text_search_keys
=
tuple
(
sql_catalog_full_text_keys
)
self
.
assert
True
(
full_text_key
in
catalog
.
sql_catalog_full_text_search_keys
)
self
.
assert
In
(
full_text_key
,
catalog
.
sql_catalog_full_text_search_keys
)
# request
# request
if
request_key
not
in
catalog
.
sql_catalog_request_keys
:
if
request_key
not
in
catalog
.
sql_catalog_request_keys
:
sql_catalog_request_keys
=
list
(
catalog
.
sql_catalog_request_keys
)
sql_catalog_request_keys
=
list
(
catalog
.
sql_catalog_request_keys
)
sql_catalog_request_keys
.
append
(
request_key
)
sql_catalog_request_keys
.
append
(
request_key
)
sql_catalog_request_keys
.
sort
()
sql_catalog_request_keys
.
sort
()
catalog
.
sql_catalog_request_keys
=
tuple
(
sql_catalog_request_keys
)
catalog
.
sql_catalog_request_keys
=
tuple
(
sql_catalog_request_keys
)
self
.
assert
True
(
request_key
in
catalog
.
sql_catalog_request_keys
)
self
.
assert
In
(
request_key
,
catalog
.
sql_catalog_request_keys
)
# multivalue
# multivalue
if
multivalue_key
not
in
catalog
.
sql_catalog_multivalue_keys
:
if
multivalue_key
not
in
catalog
.
sql_catalog_multivalue_keys
:
sql_catalog_multivalue_keys
=
list
(
catalog
.
sql_catalog_multivalue_keys
)
sql_catalog_multivalue_keys
=
list
(
catalog
.
sql_catalog_multivalue_keys
)
sql_catalog_multivalue_keys
.
append
(
multivalue_key
)
sql_catalog_multivalue_keys
.
append
(
multivalue_key
)
sql_catalog_multivalue_keys
.
sort
()
sql_catalog_multivalue_keys
.
sort
()
catalog
.
sql_catalog_multivalue_keys
=
tuple
(
sql_catalog_multivalue_keys
)
catalog
.
sql_catalog_multivalue_keys
=
tuple
(
sql_catalog_multivalue_keys
)
self
.
assert
True
(
multivalue_key
in
catalog
.
sql_catalog_multivalue_keys
)
self
.
assert
In
(
multivalue_key
,
catalog
.
sql_catalog_multivalue_keys
)
# topic keys
# topic keys
if
topic_key
not
in
catalog
.
sql_catalog_topic_search_keys
:
if
topic_key
not
in
catalog
.
sql_catalog_topic_search_keys
:
sql_catalog_topic_keys
=
list
(
catalog
.
sql_catalog_topic_search_keys
)
sql_catalog_topic_keys
=
list
(
catalog
.
sql_catalog_topic_search_keys
)
sql_catalog_topic_keys
.
append
(
topic_key
)
sql_catalog_topic_keys
.
append
(
topic_key
)
sql_catalog_topic_keys
.
sort
()
sql_catalog_topic_keys
.
sort
()
catalog
.
sql_catalog_topic_search_keys
=
tuple
(
sql_catalog_topic_keys
)
catalog
.
sql_catalog_topic_search_keys
=
tuple
(
sql_catalog_topic_keys
)
self
.
assert
True
(
topic_key
in
catalog
.
sql_catalog_topic_search_keys
)
self
.
assert
In
(
topic_key
,
catalog
.
sql_catalog_topic_search_keys
)
# scriptable keys
# scriptable keys
if
scriptable_key
not
in
catalog
.
sql_catalog_scriptable_keys
:
if
scriptable_key
not
in
catalog
.
sql_catalog_scriptable_keys
:
sql_catalog_scriptable_keys
=
list
(
catalog
.
sql_catalog_scriptable_keys
)
sql_catalog_scriptable_keys
=
list
(
catalog
.
sql_catalog_scriptable_keys
)
sql_catalog_scriptable_keys
.
append
(
scriptable_key
)
sql_catalog_scriptable_keys
.
append
(
scriptable_key
)
sql_catalog_scriptable_keys
.
sort
()
sql_catalog_scriptable_keys
.
sort
()
catalog
.
sql_catalog_scriptable_keys
=
tuple
(
sql_catalog_scriptable_keys
)
catalog
.
sql_catalog_scriptable_keys
=
tuple
(
sql_catalog_scriptable_keys
)
self
.
assert
True
(
scriptable_key
in
catalog
.
sql_catalog_scriptable_keys
)
self
.
assert
In
(
scriptable_key
,
catalog
.
sql_catalog_scriptable_keys
)
# role keys
# role keys
if
role_key
not
in
catalog
.
sql_catalog_role_keys
:
if
role_key
not
in
catalog
.
sql_catalog_role_keys
:
sql_catalog_role_keys
=
list
(
catalog
.
sql_catalog_role_keys
)
sql_catalog_role_keys
=
list
(
catalog
.
sql_catalog_role_keys
)
sql_catalog_role_keys
.
append
(
role_key
)
sql_catalog_role_keys
.
append
(
role_key
)
sql_catalog_role_keys
.
sort
()
sql_catalog_role_keys
.
sort
()
catalog
.
sql_catalog_role_keys
=
tuple
(
sql_catalog_role_keys
)
catalog
.
sql_catalog_role_keys
=
tuple
(
sql_catalog_role_keys
)
self
.
assert
True
(
role_key
in
catalog
.
sql_catalog_role_keys
)
self
.
assert
In
(
role_key
,
catalog
.
sql_catalog_role_keys
)
# local_role keys
# local_role keys
if
local_role_key
not
in
catalog
.
sql_catalog_local_role_keys
:
if
local_role_key
not
in
catalog
.
sql_catalog_local_role_keys
:
sql_catalog_local_role_keys
=
list
(
catalog
.
sql_catalog_local_role_keys
)
sql_catalog_local_role_keys
=
list
(
catalog
.
sql_catalog_local_role_keys
)
sql_catalog_local_role_keys
.
append
(
local_role_key
)
sql_catalog_local_role_keys
.
append
(
local_role_key
)
sql_catalog_local_role_keys
.
sort
()
sql_catalog_local_role_keys
.
sort
()
catalog
.
sql_catalog_local_role_keys
=
tuple
(
sql_catalog_local_role_keys
)
catalog
.
sql_catalog_local_role_keys
=
tuple
(
sql_catalog_local_role_keys
)
self
.
assert
True
(
local_role_key
in
catalog
.
sql_catalog_local_role_keys
)
self
.
assert
In
(
local_role_key
,
catalog
.
sql_catalog_local_role_keys
)
sequence
.
edit
(
related_key
=
related_key
,
result_key
=
result_key
,
sequence
.
edit
(
related_key
=
related_key
,
result_key
=
result_key
,
result_table
=
result_table
,
search_key
=
search_key
,
result_table
=
result_table
,
search_key
=
search_key
,
...
@@ -1915,10 +1915,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1915,10 +1915,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
# method related configuration
# method related configuration
self
.
assertEqual
(
catalog
.
sql_getitem_by_uid
,
'z_getitem_by_uid_2'
)
self
.
assertEqual
(
catalog
.
sql_getitem_by_uid
,
'z_getitem_by_uid_2'
)
# table related configuration
# table related configuration
self
.
assert
True
(
'translation'
in
catalog
.
sql_search_tables
)
self
.
assert
In
(
'translation'
,
catalog
.
sql_search_tables
)
# column related configuration
# column related configuration
self
.
assert
True
(
'catalog.reference'
self
.
assert
In
(
'catalog.reference'
,
in
catalog
.
sql_search_result_keys
)
catalog
.
sql_search_result_keys
)
def
stepModifyRelatedKey
(
self
,
sequence
):
def
stepModifyRelatedKey
(
self
,
sequence
):
catalog
=
self
.
getCatalogTool
().
getSQLCatalog
()
catalog
=
self
.
getCatalogTool
().
getSQLCatalog
()
...
@@ -1943,8 +1943,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1943,8 +1943,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
# stepModifyRelatedKey added related_key_2 and removed related_key
# stepModifyRelatedKey added related_key_2 and removed related_key
# but the reinstallation of the BT replaced related_key_2 with
# but the reinstallation of the BT replaced related_key_2 with
# related_key:
# related_key:
self
.
assert
True
(
related_key
in
related_key_list
)
self
.
assert
In
(
related_key
,
related_key_list
)
self
.
assert
False
(
related_key_2
in
related_key_list
)
self
.
assert
NotIn
(
related_key_2
,
related_key_list
)
# make sure there's only one entry
# make sure there's only one entry
self
.
assertTrue
(
related_key
.
startswith
(
'fake_id |'
),
related_key
)
self
.
assertTrue
(
related_key
.
startswith
(
'fake_id |'
),
related_key
)
self
.
assertEqual
(
len
([
key
for
key
in
related_key_list
self
.
assertEqual
(
len
([
key
for
key
in
related_key_list
...
@@ -1955,8 +1955,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1955,8 +1955,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
related_key
=
sequence
[
'related_key'
]
related_key
=
sequence
[
'related_key'
]
related_key_2
=
sequence
[
'related_key_2'
]
related_key_2
=
sequence
[
'related_key_2'
]
related_key_list
=
list
(
catalog
.
sql_catalog_related_keys
)
related_key_list
=
list
(
catalog
.
sql_catalog_related_keys
)
self
.
assert
True
(
related_key
in
related_key_list
)
self
.
assert
In
(
related_key
,
related_key_list
)
self
.
assert
False
(
related_key_2
in
related_key_list
)
self
.
assert
NotIn
(
related_key_2
,
related_key_list
)
# we manually duplicate the key in the list, creating an invalid situation
# we manually duplicate the key in the list, creating an invalid situation
self
.
assertEqual
(
len
([
key
for
key
in
related_key_list
self
.
assertEqual
(
len
([
key
for
key
in
related_key_list
if
key
.
startswith
(
'fake_id |'
)]),
1
)
if
key
.
startswith
(
'fake_id |'
)]),
1
)
...
@@ -1975,8 +1975,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1975,8 +1975,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
# This also means that an uninstallation of a BT does not
# This also means that an uninstallation of a BT does not
# accidentally removes an overriding key from another BT that
# accidentally removes an overriding key from another BT that
# depends on it.
# depends on it.
self
.
assert
False
(
related_key
in
related_key_list
)
self
.
assert
NotIn
(
related_key
,
related_key_list
)
self
.
assert
True
(
related_key_2
in
related_key_list
)
self
.
assert
In
(
related_key_2
,
related_key_list
)
self
.
assertEqual
(
len
([
key
for
key
in
related_key_list
self
.
assertEqual
(
len
([
key
for
key
in
related_key_list
if
key
.
startswith
(
'fake_id |'
)]),
1
)
if
key
.
startswith
(
'fake_id |'
)]),
1
)
...
@@ -1995,19 +1995,19 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1995,19 +1995,19 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
sql_search_result_keys
.
remove
(
result_key
)
sql_search_result_keys
.
remove
(
result_key
)
sql_search_result_keys
.
sort
()
sql_search_result_keys
.
sort
()
catalog
.
sql_search_result_keys
=
tuple
(
sql_search_result_keys
)
catalog
.
sql_search_result_keys
=
tuple
(
sql_search_result_keys
)
self
.
assert
True
(
result_key
not
in
catalog
.
sql_search_result_keys
)
self
.
assert
NotIn
(
result_key
,
catalog
.
sql_search_result_keys
)
# search table
# search table
sql_search_tables
=
list
(
catalog
.
sql_search_tables
)
sql_search_tables
=
list
(
catalog
.
sql_search_tables
)
sql_search_tables
.
remove
(
result_table
)
sql_search_tables
.
remove
(
result_table
)
sql_search_tables
.
sort
()
sql_search_tables
.
sort
()
catalog
.
sql_search_tables
=
tuple
(
sql_search_tables
)
catalog
.
sql_search_tables
=
tuple
(
sql_search_tables
)
self
.
assert
False
(
result_table
in
catalog
.
sql_search_tables
)
self
.
assert
NotIn
(
result_table
,
catalog
.
sql_search_tables
)
# related key
# related key
related_key_2
=
sequence
[
'related_key_2'
]
related_key_2
=
sequence
[
'related_key_2'
]
sql_catalog_related_keys
=
list
(
catalog
.
sql_catalog_related_keys
)
sql_catalog_related_keys
=
list
(
catalog
.
sql_catalog_related_keys
)
sql_catalog_related_keys
.
remove
(
related_key_2
)
sql_catalog_related_keys
.
remove
(
related_key_2
)
catalog
.
sql_catalog_related_keys
=
tuple
(
sql_catalog_related_keys
)
catalog
.
sql_catalog_related_keys
=
tuple
(
sql_catalog_related_keys
)
self
.
assert
False
(
related_key_2
in
catalog
.
sql_catalog_related_keys
)
self
.
assert
NotIn
(
related_key_2
,
catalog
.
sql_catalog_related_keys
)
def
stepAddKeysAndTableToBusinessTemplate
(
self
,
sequence
=
None
,
**
kw
):
def
stepAddKeysAndTableToBusinessTemplate
(
self
,
sequence
=
None
,
**
kw
):
"""
"""
...
@@ -2090,73 +2090,73 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -2090,73 +2090,73 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
sql_search_result_keys
.
remove
(
result_key
)
sql_search_result_keys
.
remove
(
result_key
)
sql_search_result_keys
.
sort
()
sql_search_result_keys
.
sort
()
catalog
.
sql_search_result_keys
=
tuple
(
sql_search_result_keys
)
catalog
.
sql_search_result_keys
=
tuple
(
sql_search_result_keys
)
self
.
assert
True
(
result_key
not
in
catalog
.
sql_search_result_keys
)
self
.
assert
NotIn
(
result_key
,
catalog
.
sql_search_result_keys
)
# related key
# related key
sql_search_related_keys
=
list
(
catalog
.
sql_catalog_related_keys
)
sql_search_related_keys
=
list
(
catalog
.
sql_catalog_related_keys
)
sql_search_related_keys
.
remove
(
related_key
)
sql_search_related_keys
.
remove
(
related_key
)
sql_search_related_keys
.
sort
()
sql_search_related_keys
.
sort
()
catalog
.
sql_catalog_related_keys
=
tuple
(
sql_search_related_keys
)
catalog
.
sql_catalog_related_keys
=
tuple
(
sql_search_related_keys
)
self
.
assert
True
(
related_key
not
in
catalog
.
sql_catalog_related_keys
)
self
.
assert
NotIn
(
related_key
,
catalog
.
sql_catalog_related_keys
)
# result table
# result table
sql_search_tables
=
list
(
catalog
.
sql_search_tables
)
sql_search_tables
=
list
(
catalog
.
sql_search_tables
)
sql_search_tables
.
remove
(
result_table
)
sql_search_tables
.
remove
(
result_table
)
sql_search_tables
.
sort
()
sql_search_tables
.
sort
()
catalog
.
sql_search_tables
=
tuple
(
sql_search_tables
)
catalog
.
sql_search_tables
=
tuple
(
sql_search_tables
)
self
.
assert
True
(
result_table
not
in
catalog
.
sql_search_tables
)
self
.
assert
NotIn
(
result_table
,
catalog
.
sql_search_tables
)
# search keys
# search keys
sql_catalog_search_keys
=
list
(
catalog
.
sql_catalog_search_keys
)
sql_catalog_search_keys
=
list
(
catalog
.
sql_catalog_search_keys
)
sql_catalog_search_keys
.
remove
(
search_key
)
sql_catalog_search_keys
.
remove
(
search_key
)
sql_catalog_search_keys
.
sort
()
sql_catalog_search_keys
.
sort
()
catalog
.
sql_catalog_search_keys
=
tuple
(
sql_catalog_search_keys
)
catalog
.
sql_catalog_search_keys
=
tuple
(
sql_catalog_search_keys
)
self
.
assert
True
(
search_key
not
in
catalog
.
sql_catalog_search_keys
)
self
.
assert
NotIn
(
search_key
,
catalog
.
sql_catalog_search_keys
)
# keyword keys
# keyword keys
sql_catalog_keyword_keys
=
list
(
catalog
.
sql_catalog_keyword_search_keys
)
sql_catalog_keyword_keys
=
list
(
catalog
.
sql_catalog_keyword_search_keys
)
sql_catalog_keyword_keys
.
remove
(
keyword_key
)
sql_catalog_keyword_keys
.
remove
(
keyword_key
)
sql_catalog_keyword_keys
.
sort
()
sql_catalog_keyword_keys
.
sort
()
catalog
.
sql_catalog_keyword_search_keys
=
tuple
(
sql_catalog_keyword_keys
)
catalog
.
sql_catalog_keyword_search_keys
=
tuple
(
sql_catalog_keyword_keys
)
self
.
assert
True
(
keyword_key
not
in
catalog
.
sql_catalog_keyword_search_keys
)
self
.
assert
NotIn
(
keyword_key
,
catalog
.
sql_catalog_keyword_search_keys
)
# full_text keys
# full_text keys
sql_catalog_full_text_keys
=
list
(
catalog
.
sql_catalog_full_text_search_keys
)
sql_catalog_full_text_keys
=
list
(
catalog
.
sql_catalog_full_text_search_keys
)
sql_catalog_full_text_keys
.
remove
(
full_text_key
)
sql_catalog_full_text_keys
.
remove
(
full_text_key
)
sql_catalog_full_text_keys
.
sort
()
sql_catalog_full_text_keys
.
sort
()
catalog
.
sql_catalog_full_text_search_keys
=
tuple
(
sql_catalog_full_text_keys
)
catalog
.
sql_catalog_full_text_search_keys
=
tuple
(
sql_catalog_full_text_keys
)
self
.
assert
True
(
full_text_key
not
in
catalog
.
sql_catalog_full_text_search_keys
)
self
.
assert
NotIn
(
full_text_key
,
catalog
.
sql_catalog_full_text_search_keys
)
# request
# request
sql_catalog_request_keys
=
list
(
catalog
.
sql_catalog_request_keys
)
sql_catalog_request_keys
=
list
(
catalog
.
sql_catalog_request_keys
)
sql_catalog_request_keys
.
remove
(
request_key
)
sql_catalog_request_keys
.
remove
(
request_key
)
sql_catalog_request_keys
.
sort
()
sql_catalog_request_keys
.
sort
()
catalog
.
sql_catalog_request_keys
=
tuple
(
sql_catalog_request_keys
)
catalog
.
sql_catalog_request_keys
=
tuple
(
sql_catalog_request_keys
)
self
.
assert
True
(
request_key
not
in
catalog
.
sql_catalog_request_keys
)
self
.
assert
NotIn
(
request_key
,
catalog
.
sql_catalog_request_keys
)
# multivalue
# multivalue
sql_catalog_multivalue_keys
=
list
(
catalog
.
sql_catalog_multivalue_keys
)
sql_catalog_multivalue_keys
=
list
(
catalog
.
sql_catalog_multivalue_keys
)
sql_catalog_multivalue_keys
.
remove
(
multivalue_key
)
sql_catalog_multivalue_keys
.
remove
(
multivalue_key
)
sql_catalog_multivalue_keys
.
sort
()
sql_catalog_multivalue_keys
.
sort
()
catalog
.
sql_catalog_multivalue_keys
=
tuple
(
sql_catalog_multivalue_keys
)
catalog
.
sql_catalog_multivalue_keys
=
tuple
(
sql_catalog_multivalue_keys
)
self
.
assert
True
(
multivalue_key
not
in
catalog
.
sql_catalog_multivalue_keys
)
self
.
assert
NotIn
(
multivalue_key
,
catalog
.
sql_catalog_multivalue_keys
)
# topic keys
# topic keys
sql_catalog_topic_keys
=
list
(
catalog
.
sql_catalog_topic_search_keys
)
sql_catalog_topic_keys
=
list
(
catalog
.
sql_catalog_topic_search_keys
)
sql_catalog_topic_keys
.
remove
(
topic_key
)
sql_catalog_topic_keys
.
remove
(
topic_key
)
sql_catalog_topic_keys
.
sort
()
sql_catalog_topic_keys
.
sort
()
catalog
.
sql_catalog_topic_search_keys
=
tuple
(
sql_catalog_topic_keys
)
catalog
.
sql_catalog_topic_search_keys
=
tuple
(
sql_catalog_topic_keys
)
self
.
assert
True
(
topic_key
not
in
catalog
.
sql_catalog_topic_search_keys
)
self
.
assert
NotIn
(
topic_key
,
catalog
.
sql_catalog_topic_search_keys
)
# scriptable keys
# scriptable keys
sql_catalog_scriptable_keys
=
list
(
catalog
.
sql_catalog_scriptable_keys
)
sql_catalog_scriptable_keys
=
list
(
catalog
.
sql_catalog_scriptable_keys
)
sql_catalog_scriptable_keys
.
remove
(
scriptable_key
)
sql_catalog_scriptable_keys
.
remove
(
scriptable_key
)
sql_catalog_scriptable_keys
.
sort
()
sql_catalog_scriptable_keys
.
sort
()
catalog
.
sql_catalog_scriptable_keys
=
tuple
(
sql_catalog_scriptable_keys
)
catalog
.
sql_catalog_scriptable_keys
=
tuple
(
sql_catalog_scriptable_keys
)
self
.
assert
True
(
scriptable_key
not
in
catalog
.
sql_catalog_scriptable_keys
)
self
.
assert
NotIn
(
scriptable_key
,
catalog
.
sql_catalog_scriptable_keys
)
# role keys
# role keys
sql_catalog_role_keys
=
list
(
catalog
.
sql_catalog_role_keys
)
sql_catalog_role_keys
=
list
(
catalog
.
sql_catalog_role_keys
)
sql_catalog_role_keys
.
remove
(
role_key
)
sql_catalog_role_keys
.
remove
(
role_key
)
sql_catalog_role_keys
.
sort
()
sql_catalog_role_keys
.
sort
()
catalog
.
sql_catalog_role_keys
=
tuple
(
sql_catalog_role_keys
)
catalog
.
sql_catalog_role_keys
=
tuple
(
sql_catalog_role_keys
)
self
.
assert
True
(
role_key
not
in
catalog
.
sql_catalog_role_keys
)
self
.
assert
NotIn
(
role_key
,
catalog
.
sql_catalog_role_keys
)
# local_role keys
# local_role keys
sql_catalog_local_role_keys
=
list
(
catalog
.
sql_catalog_local_role_keys
)
sql_catalog_local_role_keys
=
list
(
catalog
.
sql_catalog_local_role_keys
)
sql_catalog_local_role_keys
.
remove
(
local_role_key
)
sql_catalog_local_role_keys
.
remove
(
local_role_key
)
sql_catalog_local_role_keys
.
sort
()
sql_catalog_local_role_keys
.
sort
()
catalog
.
sql_catalog_local_role_keys
=
tuple
(
sql_catalog_local_role_keys
)
catalog
.
sql_catalog_local_role_keys
=
tuple
(
sql_catalog_local_role_keys
)
self
.
assert
True
(
local_role_key
not
in
catalog
.
sql_catalog_local_role_keys
)
self
.
assert
NotIn
(
local_role_key
,
catalog
.
sql_catalog_local_role_keys
)
def
stepCheckKeysAndTableExists
(
self
,
sequence
=
list
,
**
kw
):
def
stepCheckKeysAndTableExists
(
self
,
sequence
=
list
,
**
kw
):
"""
"""
...
@@ -2190,29 +2190,29 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -2190,29 +2190,29 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
catalog
=
self
.
getCatalogTool
().
getSQLCatalog
()
catalog
=
self
.
getCatalogTool
().
getSQLCatalog
()
self
.
assertTrue
(
catalog
is
not
None
)
self
.
assertTrue
(
catalog
is
not
None
)
# result key
# result key
self
.
assert
True
(
result_key
in
catalog
.
sql_search_result_keys
)
self
.
assert
In
(
result_key
,
catalog
.
sql_search_result_keys
)
# related key
# related key
self
.
assert
True
(
related_key
in
catalog
.
sql_catalog_related_keys
)
self
.
assert
In
(
related_key
,
catalog
.
sql_catalog_related_keys
)
# result table
# result table
self
.
assert
True
(
result_table
in
catalog
.
sql_search_tables
)
self
.
assert
In
(
result_table
,
catalog
.
sql_search_tables
)
# search key
# search key
self
.
assert
True
(
search_key
in
catalog
.
sql_catalog_search_keys
)
self
.
assert
In
(
search_key
,
catalog
.
sql_catalog_search_keys
)
# keyword key
# keyword key
self
.
assert
True
(
keyword_key
in
catalog
.
sql_catalog_keyword_search_keys
)
self
.
assert
In
(
keyword_key
,
catalog
.
sql_catalog_keyword_search_keys
)
# full text key
# full text key
self
.
assert
True
(
full_text_key
in
catalog
.
sql_catalog_full_text_search_keys
)
self
.
assert
In
(
full_text_key
,
catalog
.
sql_catalog_full_text_search_keys
)
# request key
# request key
self
.
assert
True
(
request_key
in
catalog
.
sql_catalog_request_keys
)
self
.
assert
In
(
request_key
,
catalog
.
sql_catalog_request_keys
)
# multivalue key
# multivalue key
self
.
assert
True
(
multivalue_key
in
catalog
.
sql_catalog_multivalue_keys
)
self
.
assert
In
(
multivalue_key
,
catalog
.
sql_catalog_multivalue_keys
)
# topic key
# topic key
self
.
assert
True
(
topic_key
in
catalog
.
sql_catalog_topic_search_keys
)
self
.
assert
In
(
topic_key
,
catalog
.
sql_catalog_topic_search_keys
)
# scriptable key
# scriptable key
self
.
assert
True
(
scriptable_key
in
catalog
.
sql_catalog_scriptable_keys
)
self
.
assert
In
(
scriptable_key
,
catalog
.
sql_catalog_scriptable_keys
)
# role key
# role key
self
.
assert
True
(
role_key
in
catalog
.
sql_catalog_role_keys
)
self
.
assert
In
(
role_key
,
catalog
.
sql_catalog_role_keys
)
# local_role key
# local_role key
self
.
assert
True
(
local_role_key
in
catalog
.
sql_catalog_local_role_keys
)
self
.
assert
In
(
local_role_key
,
catalog
.
sql_catalog_local_role_keys
)
def
stepCheckKeysAndTableRemoved
(
self
,
sequence
=
list
,
**
kw
):
def
stepCheckKeysAndTableRemoved
(
self
,
sequence
=
list
,
**
kw
):
"""
"""
...
@@ -2246,29 +2246,29 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -2246,29 +2246,29 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
catalog
=
self
.
getCatalogTool
().
getSQLCatalog
()
catalog
=
self
.
getCatalogTool
().
getSQLCatalog
()
self
.
assertTrue
(
catalog
is
not
None
)
self
.
assertTrue
(
catalog
is
not
None
)
# result key
# result key
self
.
assertTrue
(
result_key
not
in
catalog
.
sql_search_result_keys
)
self
.
assertTrue
(
result_key
,
catalog
.
sql_search_result_keys
)
# related key
# related key
self
.
assertTrue
(
related_key
not
in
catalog
.
sql_catalog_related_keys
)
self
.
assertTrue
(
related_key
,
catalog
.
sql_catalog_related_keys
)
# result table
# result table
self
.
assertTrue
(
result_table
not
in
catalog
.
sql_search_tables
)
self
.
assertTrue
(
result_table
,
catalog
.
sql_search_tables
)
# search key
# search key
self
.
assertTrue
(
search_key
not
in
catalog
.
sql_catalog_search_keys
)
self
.
assertTrue
(
search_key
,
catalog
.
sql_catalog_search_keys
)
# keyword key
# keyword key
self
.
assertTrue
(
keyword_key
not
in
catalog
.
sql_catalog_keyword_search_keys
)
self
.
assertTrue
(
keyword_key
,
catalog
.
sql_catalog_keyword_search_keys
)
# full text key
# full text key
self
.
assertTrue
(
full_text_key
not
in
catalog
.
sql_catalog_full_text_search_keys
)
self
.
assertTrue
(
full_text_key
,
catalog
.
sql_catalog_full_text_search_keys
)
# request key
# request key
self
.
assertTrue
(
request_key
not
in
catalog
.
sql_catalog_request_keys
)
self
.
assertTrue
(
request_key
,
catalog
.
sql_catalog_request_keys
)
# multivalue key
# multivalue key
self
.
assertTrue
(
multivalue_key
not
in
catalog
.
sql_catalog_multivalue_keys
)
self
.
assertTrue
(
multivalue_key
,
catalog
.
sql_catalog_multivalue_keys
)
# topic key
# topic key
self
.
assertTrue
(
topic_key
not
in
catalog
.
sql_catalog_topic_search_keys
)
self
.
assertTrue
(
topic_key
,
catalog
.
sql_catalog_topic_search_keys
)
# scriptable key
# scriptable key
self
.
assertTrue
(
scriptable_key
not
in
catalog
.
sql_catalog_scriptable_keys
)
self
.
assertTrue
(
scriptable_key
,
catalog
.
sql_catalog_scriptable_keys
)
# role key
# role key
self
.
assertTrue
(
role_key
not
in
catalog
.
sql_catalog_role_keys
)
self
.
assertTrue
(
role_key
,
catalog
.
sql_catalog_role_keys
)
# local_role key
# local_role key
self
.
assertTrue
(
local_role_key
not
in
catalog
.
sql_catalog_local_role_keys
)
self
.
assertTrue
(
local_role_key
,
catalog
.
sql_catalog_local_role_keys
)
# Roles
# Roles
def
stepCreateRole
(
self
,
sequence
=
None
,
**
kw
):
def
stepCreateRole
(
self
,
sequence
=
None
,
**
kw
):
...
@@ -2280,7 +2280,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -2280,7 +2280,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
role_list
=
list
(
p
.
__ac_roles__
)
role_list
=
list
(
p
.
__ac_roles__
)
role_list
.
append
(
new_role
)
role_list
.
append
(
new_role
)
p
.
__ac_roles__
=
tuple
(
role_list
)
p
.
__ac_roles__
=
tuple
(
role_list
)
self
.
assert
True
(
new_role
in
p
.
__ac_roles__
)
self
.
assert
In
(
new_role
,
p
.
__ac_roles__
)
sequence
.
edit
(
role
=
new_role
)
sequence
.
edit
(
role
=
new_role
)
def
stepRemoveRole
(
self
,
sequence
=
None
,
**
kw
):
def
stepRemoveRole
(
self
,
sequence
=
None
,
**
kw
):
...
@@ -2293,7 +2293,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -2293,7 +2293,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
role_list
=
list
(
p
.
__ac_roles__
)
role_list
=
list
(
p
.
__ac_roles__
)
role_list
.
remove
(
role
)
role_list
.
remove
(
role
)
p
.
__ac_roles__
=
tuple
(
role_list
)
p
.
__ac_roles__
=
tuple
(
role_list
)
self
.
assert
True
(
role
not
in
p
.
__ac_roles__
)
self
.
assert
NotIn
(
role
,
p
.
__ac_roles__
)
def
stepAddRoleToBusinessTemplate
(
self
,
sequence
=
None
,
**
kw
):
def
stepAddRoleToBusinessTemplate
(
self
,
sequence
=
None
,
**
kw
):
"""
"""
...
@@ -2312,7 +2312,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -2312,7 +2312,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
role
=
sequence
.
get
(
'role'
,
None
)
role
=
sequence
.
get
(
'role'
,
None
)
self
.
assertTrue
(
role
is
not
None
)
self
.
assertTrue
(
role
is
not
None
)
p
=
self
.
getPortal
()
p
=
self
.
getPortal
()
self
.
assert
True
(
role
in
p
.
__ac_roles__
)
self
.
assert
In
(
role
,
p
.
__ac_roles__
)
def
stepCheckRoleRemoved
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckRoleRemoved
(
self
,
sequence
=
None
,
**
kw
):
"""
"""
...
@@ -2321,7 +2321,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -2321,7 +2321,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
role
=
sequence
.
get
(
'role'
,
None
)
role
=
sequence
.
get
(
'role'
,
None
)
self
.
assertTrue
(
role
is
not
None
)
self
.
assertTrue
(
role
is
not
None
)
p
=
self
.
getPortal
()
p
=
self
.
getPortal
()
self
.
assert
True
(
role
not
in
p
.
__ac_roles__
)
self
.
assert
NotIn
(
role
,
p
.
__ac_roles__
)
# Local Roles
# Local Roles
def
stepCreateLocalRoles
(
self
,
sequence
=
None
,
**
kw
):
def
stepCreateLocalRoles
(
self
,
sequence
=
None
,
**
kw
):
...
@@ -2391,7 +2391,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -2391,7 +2391,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
sql_connection
=
self
.
getSQLConnection
()
sql_connection
=
self
.
getSQLConnection
()
result
=
sql_connection
.
manage_test
(
sql
)
result
=
sql_connection
.
manage_test
(
sql
)
for
line
in
result
:
for
line
in
result
:
self
.
assert
True
((
line
.
uid
,
line
.
role
)
not
in
before_update_local_roles
)
self
.
assert
NotIn
((
line
.
uid
,
line
.
role
),
before_update_local_roles
)
def
stepCheckLocalRolesRemoved
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckLocalRolesRemoved
(
self
,
sequence
=
None
,
**
kw
):
"""
"""
...
@@ -2438,13 +2438,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -2438,13 +2438,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
Check migration of Property Sheets from the Filesystem to ZODB
Check migration of Property Sheets from the Filesystem to ZODB
"""
"""
property_sheet_tool
=
self
.
getPortalObject
().
portal_property_sheets
property_sheet_tool
=
self
.
getPortalObject
().
portal_property_sheets
self
.
assert
True
(
'UnitTest'
in
property_sheet_tool
.
objectIds
())
self
.
assert
In
(
'UnitTest'
,
property_sheet_tool
.
objectIds
())
property_list
=
property_sheet_tool
.
UnitTest
.
contentValues
()
property_list
=
property_sheet_tool
.
UnitTest
.
contentValues
()
self
.
assertEqual
(
len
(
property_list
),
1
)
self
.
assertEqual
(
len
(
property_list
),
1
)
self
.
assert
True
(
property_list
[
0
].
getReference
()
==
'ps_prop1'
)
self
.
assert
Equal
(
property_list
[
0
].
getReference
(),
'ps_prop1'
)
self
.
assert
True
(
property_list
[
0
].
getElementaryType
()
==
'string'
)
self
.
assert
Equal
(
property_list
[
0
].
getElementaryType
(),
'string'
)
def
stepRemovePropertySheet
(
self
,
sequence
=
None
,
sequencer_list
=
None
,
**
kw
):
def
stepRemovePropertySheet
(
self
,
sequence
=
None
,
sequencer_list
=
None
,
**
kw
):
"""
"""
...
@@ -2504,7 +2504,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -2504,7 +2504,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
"""
ps_id
=
sequence
.
get
(
'ps_title'
,
None
)
ps_id
=
sequence
.
get
(
'ps_title'
,
None
)
self
.
assertFalse
(
ps_id
is
None
)
self
.
assertFalse
(
ps_id
is
None
)
self
.
assert
False
(
ps_id
in
self
.
getPortalObject
().
portal_property_sheets
.
objectIds
())
self
.
assert
NotIn
(
ps_id
,
self
.
getPortalObject
().
portal_property_sheets
.
objectIds
())
def
stepCreateUpdatedPropertySheet
(
self
,
sequence
=
None
,
**
kw
):
def
stepCreateUpdatedPropertySheet
(
self
,
sequence
=
None
,
**
kw
):
"""
"""
...
@@ -2921,29 +2921,29 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -2921,29 +2921,29 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
ps
=
self
.
getSkinsTool
()
ps
=
self
.
getSkinsTool
()
skin_id
=
sequence
.
get
(
'skin_folder_id'
)
skin_id
=
sequence
.
get
(
'skin_folder_id'
)
# a new skin selection is added
# a new skin selection is added
self
.
assert
True
(
'Foo'
in
ps
.
getSkinSelections
())
self
.
assert
In
(
'Foo'
,
ps
.
getSkinSelections
())
# and it contains good layers
# and it contains good layers
layers
=
ps
.
getSkinPath
(
'Foo'
).
split
(
','
)
layers
=
ps
.
getSkinPath
(
'Foo'
).
split
(
','
)
self
.
assert
True
(
skin_id
in
layers
,
layers
)
self
.
assert
In
(
skin_id
,
layers
)
self
.
assert
True
(
'erp5_core'
in
layers
,
layers
)
self
.
assert
In
(
'erp5_core'
,
layers
)
self
.
assert
False
(
'erp5_xhtml_style'
in
layers
,
layers
)
self
.
assert
NotIn
(
'erp5_xhtml_style'
,
layers
)
skin_folder
=
ps
.
_getOb
(
skin_id
,
None
)
skin_folder
=
ps
.
_getOb
(
skin_id
,
None
)
skin_selection_list
=
skin_folder
.
getProperty
(
skin_selection_list
=
skin_folder
.
getProperty
(
'business_template_registered_skin_selections'
,
())
'business_template_registered_skin_selections'
,
())
self
.
assert
True
(
'Foo'
in
skin_selection_list
)
self
.
assert
In
(
'Foo'
,
skin_selection_list
)
def
stepCheckStaticSkinSelection
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckStaticSkinSelection
(
self
,
sequence
=
None
,
**
kw
):
ps
=
self
.
getSkinsTool
()
ps
=
self
.
getSkinsTool
()
skin_id
=
sequence
.
get
(
'skin_folder_id'
)
skin_id
=
sequence
.
get
(
'skin_folder_id'
)
static_skin_id
=
sequence
.
get
(
'static_skin_folder_id'
)
static_skin_id
=
sequence
.
get
(
'static_skin_folder_id'
)
# a new skin selection is added
# a new skin selection is added
self
.
assert
True
(
'Foo'
in
ps
.
getSkinSelections
())
self
.
assert
In
(
'Foo'
,
ps
.
getSkinSelections
())
# and it contains good layers
# and it contains good layers
layers
=
ps
.
getSkinPath
(
'Foo'
).
split
(
','
)
layers
=
ps
.
getSkinPath
(
'Foo'
).
split
(
','
)
self
.
assert
True
(
skin_id
in
layers
,
layers
)
self
.
assert
In
(
skin_id
,
layers
)
self
.
assert
True
(
'erp5_core'
in
layers
,
layers
)
self
.
assert
In
(
'erp5_core'
,
layers
)
self
.
assert
False
(
'erp5_xhtml_style'
in
layers
,
layers
)
self
.
assert
NotIn
(
'erp5_xhtml_style'
,
layers
)
self
.
assert
True
(
static_skin_id
in
layers
,
layers
)
self
.
assert
In
(
static_skin_id
,
layers
)
def
stepCreateCustomWorkflow
(
self
,
sequence
=
None
,
**
kw
):
def
stepCreateCustomWorkflow
(
self
,
sequence
=
None
,
**
kw
):
"""
"""
...
@@ -2973,8 +2973,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -2973,8 +2973,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
"""
pt
=
self
.
getTemplateTool
()
pt
=
self
.
getTemplateTool
()
template
=
pt
.
newContent
(
portal_type
=
'Business Template'
)
template
=
pt
.
newContent
(
portal_type
=
'Business Template'
)
self
.
assert
True
(
template
.
getBuildingState
()
==
'draft'
)
self
.
assert
Equals
(
template
.
getBuildingState
(),
'draft'
)
self
.
assert
True
(
template
.
getInstallationState
()
==
'not_installed'
)
self
.
assert
Equals
(
template
.
getInstallationState
(),
'not_installed'
)
template
.
edit
(
title
=
'custom geek template'
,
template
.
edit
(
title
=
'custom geek template'
,
version
=
'1.0'
,
version
=
'1.0'
,
description
=
'custom bt for unit_test'
)
description
=
'custom bt for unit_test'
)
...
@@ -3180,7 +3180,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -3180,7 +3180,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
python_script_id
=
sequence
.
get
(
'python_script_id'
)
python_script_id
=
sequence
.
get
(
'python_script_id'
)
skin_folder_id
=
sequence
.
get
(
'skin_folder_id'
)
skin_folder_id
=
sequence
.
get
(
'skin_folder_id'
)
folder
=
self
.
portal
.
portal_skins
[
skin_folder_id
]
folder
=
self
.
portal
.
portal_skins
[
skin_folder_id
]
self
.
assert
True
(
python_script_id
not
in
folder
.
objectIds
())
self
.
assert
NotIn
(
python_script_id
,
folder
.
objectIds
())
def
stepSetOldSitePropertyValue
(
self
,
sequence
=
None
,
**
kw
):
def
stepSetOldSitePropertyValue
(
self
,
sequence
=
None
,
**
kw
):
"""Set the old value to a site property."""
"""Set the old value to a site property."""
...
@@ -3221,13 +3221,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -3221,13 +3221,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
"""
Check that a skin selection has been removed.
Check that a skin selection has been removed.
"""
"""
self
.
assert
True
(
'Foo'
not
in
self
.
portal
.
portal_skins
.
getSkinSelections
())
self
.
assert
NotIn
(
'Foo'
,
self
.
portal
.
portal_skins
.
getSkinSelections
())
def
stepCheckSkinSelectionNotRemoved
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckSkinSelectionNotRemoved
(
self
,
sequence
=
None
,
**
kw
):
"""
"""
Check that a skin selection has not been removed.
Check that a skin selection has not been removed.
"""
"""
self
.
assert
True
(
'Foo'
in
self
.
portal
.
portal_skins
.
getSkinSelections
())
self
.
assert
In
(
'Foo'
,
self
.
portal
.
portal_skins
.
getSkinSelections
())
def
stepUserDisableSkinSelectionRegistration
(
self
,
sequence
=
None
,
**
kw
):
def
stepUserDisableSkinSelectionRegistration
(
self
,
sequence
=
None
,
**
kw
):
"""
"""
...
@@ -3253,9 +3253,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -3253,9 +3253,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
select_skin_to_be_changed_list
=
sequence
.
get
(
'select_skin_to_be_changed_list'
)
select_skin_to_be_changed_list
=
sequence
.
get
(
'select_skin_to_be_changed_list'
)
select_skin_not_to_be_changed_list
=
sequence
.
get
(
'select_skin_not_to_be_changed_list'
)
select_skin_not_to_be_changed_list
=
sequence
.
get
(
'select_skin_not_to_be_changed_list'
)
for
skin_name
in
select_skin_to_be_changed_list
:
for
skin_name
in
select_skin_to_be_changed_list
:
self
.
assert
True
(
skin_folder_id
in
self
.
portal
.
portal_skins
.
getSkinPath
(
skin_name
))
self
.
assert
In
(
skin_folder_id
,
self
.
portal
.
portal_skins
.
getSkinPath
(
skin_name
))
for
skin_name
in
select_skin_not_to_be_changed_list
:
for
skin_name
in
select_skin_not_to_be_changed_list
:
self
.
assert
True
(
skin_folder_id
not
in
self
.
portal
.
portal_skins
.
getSkinPath
(
skin_name
))
self
.
assert
NotIn
(
skin_folder_id
,
self
.
portal
.
portal_skins
.
getSkinPath
(
skin_name
))
def
stepCheckSkinFolderPriorityOn
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckSkinFolderPriorityOn
(
self
,
sequence
=
None
,
**
kw
):
"""
"""
...
@@ -6424,11 +6424,11 @@ class TestBusinessTemplate(BusinessTemplateMixin):
...
@@ -6424,11 +6424,11 @@ class TestBusinessTemplate(BusinessTemplateMixin):
# This type provider, will be automatically registered on types tool during
# This type provider, will be automatically registered on types tool during
# business template installation, because it contains type information
# business template installation, because it contains type information
self
.
assert
True
(
'dummy_type_provider'
in
types_tool
.
type_provider_list
)
self
.
assert
In
(
'dummy_type_provider'
,
types_tool
.
type_provider_list
)
# The type is reinstalled
# The type is reinstalled
self
.
assert
True
(
'Dummy Type'
in
type_provider
.
objectIds
())
self
.
assert
In
(
'Dummy Type'
,
type_provider
.
objectIds
())
# is available from types tool
# is available from types tool
self
.
assert
True
(
'Dummy Type'
in
[
ti
.
getId
()
for
self
.
assert
In
(
'Dummy Type'
,
[
ti
.
getId
()
for
ti
in
types_tool
.
listTypeInfo
()])
ti
in
types_tool
.
listTypeInfo
()])
dummy_type
=
types_tool
.
getTypeInfo
(
'Dummy Type'
)
dummy_type
=
types_tool
.
getTypeInfo
(
'Dummy Type'
)
...
@@ -6459,7 +6459,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
...
@@ -6459,7 +6459,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
new_bt
.
uninstall
()
new_bt
.
uninstall
()
self
.
assertNotEquals
(
None
,
types_tool
.
getTypeInfo
(
'Base Category'
))
self
.
assertNotEquals
(
None
,
types_tool
.
getTypeInfo
(
'Base Category'
))
self
.
assertEqual
(
None
,
types_tool
.
getTypeInfo
(
'Dummy Type'
))
self
.
assertEqual
(
None
,
types_tool
.
getTypeInfo
(
'Dummy Type'
))
self
.
assert
False
(
'dummy_type_provider'
in
types_tool
.
type_provider_list
)
self
.
assert
NotIn
(
'dummy_type_provider'
,
types_tool
.
type_provider_list
)
def
test_type_provider_2
(
self
):
def
test_type_provider_2
(
self
):
self
.
portal
.
newContent
(
id
=
'dummy_type_provider'
,
portal_type
=
"Types Tool"
)
self
.
portal
.
newContent
(
id
=
'dummy_type_provider'
,
portal_type
=
"Types Tool"
)
...
@@ -6500,7 +6500,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
...
@@ -6500,7 +6500,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
# This type provider, will be automatically registered on types tool during
# This type provider, will be automatically registered on types tool during
# business template installation, because it contains type information
# business template installation, because it contains type information
self
.
assert
True
(
'dummy_type_provider'
in
types_tool
.
type_provider_list
)
self
.
assert
In
(
'dummy_type_provider'
,
types_tool
.
type_provider_list
)
# Create a business template that has the same title but does not
# Create a business template that has the same title but does not
# contain type_provider.
# contain type_provider.
...
@@ -6521,7 +6521,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
...
@@ -6521,7 +6521,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
new_bt
.
install
(
force
=
0
,
object_to_update
=
{
'dummy_type_provider'
:
'remove'
})
new_bt
.
install
(
force
=
0
,
object_to_update
=
{
'dummy_type_provider'
:
'remove'
})
self
.
assertNotEquals
(
None
,
types_tool
.
getTypeInfo
(
'Base Category'
))
self
.
assertNotEquals
(
None
,
types_tool
.
getTypeInfo
(
'Base Category'
))
self
.
assert
False
(
'dummy_type_provider'
in
types_tool
.
type_provider_list
)
self
.
assert
NotIn
(
'dummy_type_provider'
,
types_tool
.
type_provider_list
)
def
test_global_action
(
self
):
def
test_global_action
(
self
):
# Tests that global actions are properly exported and reimported
# Tests that global actions are properly exported and reimported
...
@@ -7526,7 +7526,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
...
@@ -7526,7 +7526,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
def
stepCheckZodbDocumentRemoved
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckZodbDocumentRemoved
(
self
,
sequence
=
None
,
**
kw
):
component_tool
=
self
.
getPortalObject
().
portal_components
component_tool
=
self
.
getPortalObject
().
portal_components
self
.
assert
False
(
sequence
[
'document_id'
]
in
component_tool
.
objectIds
())
self
.
assert
NotIn
(
sequence
[
'document_id'
],
component_tool
.
objectIds
())
def
stepRemoveZodbDocument
(
self
,
sequence
=
None
,
**
kw
):
def
stepRemoveZodbDocument
(
self
,
sequence
=
None
,
**
kw
):
self
.
portal
.
portal_components
.
manage_delObjects
([
sequence
[
'document_id'
]])
self
.
portal
.
portal_components
.
manage_delObjects
([
sequence
[
'document_id'
]])
...
@@ -7559,7 +7559,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
...
@@ -7559,7 +7559,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
first_line
=
source_code
.
split
(
'
\
n
'
,
1
)[
0
]
first_line
=
source_code
.
split
(
'
\
n
'
,
1
)[
0
]
with
open
(
xml_path
)
as
f
:
with
open
(
xml_path
)
as
f
:
for
line
in
f
:
for
line
in
f
:
self
.
assert
False
(
first_line
in
line
)
self
.
assert
NotIn
(
first_line
,
line
)
def
test_BusinessTemplateWithZodbDocument
(
self
):
def
test_BusinessTemplateWithZodbDocument
(
self
):
sequence_list
=
SequenceList
()
sequence_list
=
SequenceList
()
...
@@ -7697,7 +7697,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
...
@@ -7697,7 +7697,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
[
component_id
])
[
component_id
])
component_tool
=
self
.
getPortalObject
().
portal_components
component_tool
=
self
.
getPortalObject
().
portal_components
self
.
assert
True
(
component_id
in
component_tool
.
objectIds
())
self
.
assert
In
(
component_id
,
component_tool
.
objectIds
())
component
=
getattr
(
component_tool
,
component_id
)
component
=
getattr
(
component_tool
,
component_id
)
self
.
assertEqual
(
component
.
getReference
(),
sequence
[
'document_title'
])
self
.
assertEqual
(
component
.
getReference
(),
sequence
[
'document_title'
])
...
...
Jérome Perrin
@jerome
mentioned in merge request
!21 (merged)
·
Jan 13, 2017
mentioned in merge request
!21 (merged)
mentioned in merge request !21
Toggle commit list
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