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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
erp5
Commits
acd28780
Commit
acd28780
authored
May 09, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify _testSubContentReindexing
parent
69dcc9db
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
39 deletions
+16
-39
product/ERP5Type/tests/utils.py
product/ERP5Type/tests/utils.py
+16
-39
No files found.
product/ERP5Type/tests/utils.py
View file @
acd28780
...
@@ -635,50 +635,27 @@ def updateCellList(portal, line, cell_type, cell_range_method, cell_dict_list):
...
@@ -635,50 +635,27 @@ def updateCellList(portal, line, cell_type, cell_range_method, cell_dict_list):
cell
.
edit
(
predicate_category_list
=
category_list
,
cell
.
edit
(
predicate_category_list
=
category_list
,
variation_category_list
=
category_list
)
variation_category_list
=
category_list
)
def
catalogObjectListWrapper
(
self
,
object_list
,
method_id_list
=
None
,
disable_cache
=
0
,
check_uid
=
1
,
idxs
=
None
):
"""Wrapper to mark inside of portal object list of catalogged objects"""
import
transaction
portal
=
self
.
getPortalObject
()
for
q
in
object_list
:
portal
.
catalogged_object_path_dict
[
q
.
getPath
()]
=
1
transaction
.
commit
()
class
SubcontentReindexingWrapper
(
object
):
class
SubcontentReindexingWrapper
(
object
):
def
wrap_catalogObjectList
(
self
):
self
.
original_catalogObjectList
=
Catalog
.
catalogObjectList
Catalog
.
catalogObjectList
=
catalogObjectListWrapper
def
unwrap_catalogObjectList
(
self
):
Catalog
.
catalogObjectList
=
self
.
original_catalogObjectList
def
_testSubContentReindexing
(
self
,
parent_document
,
children_document_list
):
def
_testSubContentReindexing
(
self
,
parent_document
,
children_document_list
):
"""Helper method which shall be called *before* tic or commit"""
# cleanup existing reindexing
transaction
.
commit
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
parent_document
.
reindexObject
()
def
catalogObjectList
(
self
,
object_list
,
*
args
,
**
kw
):
self
.
portal
.
catalogged_object_path_dict
=
PersistentMapping
()
"""Wrapper to track list of catalogged objects"""
transaction
.
commit
()
for
q
in
object_list
:
expected_path_list
=
[
q
.
getPath
()
for
q
in
children_document_list
+
catalogged_object_path_set
.
add
(
q
.
getPath
())
[
parent_document
]]
return
orig_catalogObjectList
(
self
,
object_list
,
*
args
,
**
kw
)
orig_catalogObjectList
=
Catalog
.
__dict__
[
'catalogObjectList'
]
expected_path_set
=
set
(
q
.
getPath
()
for
q
in
children_document_list
+
[
parent_document
])
self
.
assertEqual
(
expected_path_set
,
set
(
x
.
getPath
()
for
x
in
self
.
portal
.
portal_catalog
(
path
=
expected_path_set
)))
try
:
try
:
# wrap call to catalogObjectList
Catalog
.
catalogObjectList
=
catalogObjectList
self
.
wrap_catalogObjectList
()
catalogged_object_path_set
=
set
()
self
.
stepTic
()
self
.
assertSameSet
(
self
.
portal
.
catalogged_object_path_dict
.
keys
(),
expected_path_list
)
# do real assertions
self
.
portal
.
catalogged_object_path_dict
=
PersistentMapping
()
transaction
.
commit
()
parent_document
.
reindexObject
()
parent_document
.
reindexObject
()
self
.
stepTic
()
transaction
.
commit
()
self
.
assertSameSet
(
self
.
tic
()
self
.
portal
.
catalogged_object_path_dict
.
keys
(),
self
.
assertEqual
(
expected_path_set
,
catalogged_object_path_set
)
expected_path_list
)
finally
:
finally
:
# unwrap catalogObjectList
Catalog
.
catalogObjectList
=
orig_catalogObjectList
self
.
unwrap_catalogObjectList
()
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