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
Binh
erp5
Commits
3abb3620
Commit
3abb3620
authored
Jan 26, 2018
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testERP5Catalog: Simplify.
Also, add an XXX about manage_test annoying behaviour.
parent
69bfbb92
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
32 deletions
+7
-32
product/ERP5Catalog/tests/testERP5Catalog.py
product/ERP5Catalog/tests/testERP5Catalog.py
+7
-32
No files found.
product/ERP5Catalog/tests/testERP5Catalog.py
View file @
3abb3620
...
@@ -145,9 +145,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
...
@@ -145,9 +145,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
sql_connection
=
getattr
(
self
.
getPortal
(),
connection_id
)
sql_connection
=
getattr
(
self
.
getPortal
(),
connection_id
)
if
sql
is
None
:
if
sql
is
None
:
sql
=
'select distinct(path) from catalog'
sql
=
'select distinct(path) from catalog'
result
=
sql_connection
.
manage_test
(
sql
)
# XXX: manage_test has an implicit "LIMIT 1000" which cannot be disabled.
path_list
=
map
(
lambda
x
:
x
[
'path'
],
result
)
return
[
x
[
'path'
]
for
x
in
sql_connection
.
manage_test
(
sql
)]
return
path_list
def
getSQLPathListWithRolesAndUsers
(
self
,
connection_id
):
def
getSQLPathListWithRolesAndUsers
(
self
,
connection_id
):
sql
=
'select distinct(path) from catalog, roles_and_users
\
sql
=
'select distinct(path) from catalog, roles_and_users
\
...
@@ -374,41 +373,17 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
...
@@ -374,41 +373,17 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
self
.
assertTrue
(
len
(
uid_buffer
)
==
0
)
self
.
assertTrue
(
len
(
uid_buffer
)
==
0
)
def
test_13_ERP5Site_reindexAll
(
self
):
def
test_13_ERP5Site_reindexAll
(
self
):
# Flush message queue
self
.
tic
()
# Create some objects
portal
=
self
.
getPortal
()
portal
=
self
.
getPortal
()
portal_category
=
self
.
getCategoryTool
()
self
.
getCategoryTool
().
newContent
(
portal_type
=
'Base Category'
,
title
=
"GreatTitle1"
)
base_category
=
portal_category
.
newContent
(
portal_type
=
'Base Category'
,
portal
.
getDefaultModule
(
'Organisation'
).
newContent
(
portal_type
=
'Organisation'
,
title
=
"GreatTitle2"
)
title
=
"GreatTitle1"
)
module
=
portal
.
getDefaultModule
(
'Organisation'
)
organisation
=
module
.
newContent
(
portal_type
=
'Organisation'
,
title
=
"GreatTitle2"
)
# Flush message queue
self
.
tic
()
self
.
tic
()
original_path_list
=
self
.
getSQLPathList
()
original_path_list
=
self
.
getSQLPathList
()
# Clear catalog
self
.
getCatalogTool
().
manage_catalogClear
()
portal_catalog
=
self
.
getCatalogTool
()
self
.
assertEqual
([],
self
.
getSQLPathList
())
portal_catalog
.
manage_catalogClear
()
sql_connection
=
self
.
getSQLConnection
()
sql
=
'select count(*) from catalog where portal_type!=NULL'
result
=
sql_connection
.
manage_test
(
sql
)
message_count
=
result
[
0
][
'COUNT(*)'
]
self
.
assertEqual
(
0
,
message_count
)
# Commit
self
.
commit
()
# Reindex all
portal
.
ERP5Site_reindexAll
()
portal
.
ERP5Site_reindexAll
()
self
.
tic
()
self
.
tic
()
self
.
commit
()
# Check catalog
sql
=
'select count(*) from message'
result
=
sql_connection
.
manage_test
(
sql
)
message_count
=
result
[
0
][
'COUNT(*)'
]
self
.
assertEqual
(
0
,
message_count
)
# Check if all objects are catalogued as before
# Check if all objects are catalogued as before
new_path_list
=
self
.
getSQLPathList
()
self
.
assertTrue
(
set
(
original_path_list
).
issubset
(
self
.
getSQLPathList
()))
self
.
assertTrue
(
set
(
original_path_list
).
issubset
(
new_path_list
))
def
test_14_ReindexWithBrokenCategory
(
self
):
def
test_14_ReindexWithBrokenCategory
(
self
):
"""Reindexing an object with 1 broken category must not affect other valid
"""Reindexing an object with 1 broken category must not affect other valid
...
...
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