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
7a9f6e3c
Commit
7a9f6e3c
authored
Aug 09, 2016
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_catalog: Update tests according to the changes in ERP5Catalog
parent
716edcab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
38 deletions
+42
-38
product/ERP5Catalog/tests/testERP5Catalog.py
product/ERP5Catalog/tests/testERP5Catalog.py
+40
-36
product/ERP5Catalog/tests/testERP5CatalogSecurityUidOptimization.py
...P5Catalog/tests/testERP5CatalogSecurityUidOptimization.py
+2
-2
No files found.
product/ERP5Catalog/tests/testERP5Catalog.py
View file @
7a9f6e3c
...
...
@@ -582,14 +582,14 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
"""
%
{
'query_table'
:
query_table
}
portal_skins_custom
=
portal
.
portal_skins
.
custom
portal_skins_custom
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
portal_skins_custom
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'testMethod'
,
title
=
''
,
connection_id
=
'erp5_sql_connection'
,
arguments
=
"
\
n
"
.
join
([
'from_table_list'
,
'where_expression'
,
'order_by_expression'
]),
template
=
sql_squeleton
)
src
=
sql_squeleton
)
testMethod
=
portal_skins_custom
[
'testMethod'
]
default_parametrs
=
{}
...
...
@@ -1476,14 +1476,14 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
"""
for
catalog
,
connection_id
in
((
original_catalog
,
original_connection_id
),
(
new_catalog
,
self
.
new_erp5_sql_connection
)):
catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z_create_dummy_table'
,
title
=
''
,
arguments
=
""
,
connection_id
=
connection_id
,
template
=
create_dummy_table_sql
)
catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
src
=
create_dummy_table_sql
)
catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z0_drop_dummy_table'
,
title
=
''
,
arguments
=
""
,
connection_id
=
connection_id
,
template
=
drop_summy_table_sql
)
src
=
drop_summy_table_sql
)
# update catalog configuration and declare new ZSQLMethods
sql_clear_catalog_list
=
list
(
original_catalog
.
sql_clear_catalog
)
...
...
@@ -2389,6 +2389,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
# Add a new table to the catalog
sql_catalog
=
self
.
portal
.
portal_catalog
.
getSQLCatalog
()
sql_catalog
.
manage_setLocalRoles
(
user1
,
[
'Author'
,
'Auditor'
,
'Manager'
])
local_roles_table
=
"test_local_roles"
...
...
@@ -2400,22 +2401,22 @@ CREATE TABLE `%s` (
KEY `version` (`owner_reference`)
) ENGINE=InnoDB;
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z_create_%s'
%
local_roles_table
,
title
=
''
,
arguments
=
""
,
connection_id
=
'erp5_sql_connection'
,
template
=
create_local_role_table_sql
)
src
=
create_local_role_table_sql
)
drop_local_role_table_sql
=
"""
DROP TABLE IF EXISTS %s
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z0_drop_%s'
%
local_roles_table
,
title
=
''
,
arguments
=
""
,
connection_id
=
'erp5_sql_connection'
,
template
=
drop_local_role_table_sql
)
src
=
drop_local_role_table_sql
)
catalog_local_role_sql
=
"""
REPLACE INTO
...
...
@@ -2432,13 +2433,13 @@ VALUES
</dtml-if>
</dtml-in>
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z_catalog_%s_list'
%
local_roles_table
,
title
=
''
,
connection_id
=
'erp5_sql_connection'
,
arguments
=
"
\
n
"
.
join
([
'uid'
,
'Base_getOwnerId'
]),
template
=
catalog_local_role_sql
)
src
=
catalog_local_role_sql
)
self
.
commit
()
current_sql_catalog_object_list
=
sql_catalog
.
sql_catalog_object_list
...
...
@@ -2571,6 +2572,7 @@ VALUES
# Add a new table to the catalog
sql_catalog
=
self
.
portal
.
portal_catalog
.
getSQLCatalog
()
sql_catalog
.
manage_setLocalRoles
(
user1
,
[
'Author'
,
'Auditor'
,
'Manager'
])
local_roles_table
=
"test_assignee_local_roles"
...
...
@@ -2584,22 +2586,22 @@ CREATE TABLE `%s` (
KEY `viewable_assignee_reference` (`viewable_assignee_reference`)
) ENGINE=InnoDB;
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z_create_%s'
%
local_roles_table
,
title
=
''
,
arguments
=
""
,
connection_id
=
'erp5_sql_connection'
,
template
=
create_local_role_table_sql
)
src
=
create_local_role_table_sql
)
drop_local_role_table_sql
=
"""
DROP TABLE IF EXISTS %s
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z0_drop_%s'
%
local_roles_table
,
title
=
''
,
arguments
=
""
,
connection_id
=
'erp5_sql_connection'
,
template
=
drop_local_role_table_sql
)
src
=
drop_local_role_table_sql
)
catalog_local_role_sql
=
"""
REPLACE INTO
...
...
@@ -2617,14 +2619,14 @@ VALUES
</dtml-if>
</dtml-in>
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z_catalog_%s_list'
%
local_roles_table
,
title
=
''
,
connection_id
=
'erp5_sql_connection'
,
arguments
=
"
\
n
"
.
join
([
'uid'
,
'getAssignee'
,
'getViewPermissionAssignee'
]),
template
=
catalog_local_role_sql
)
src
=
catalog_local_role_sql
)
self
.
commit
()
current_sql_catalog_object_list
=
sql_catalog
.
sql_catalog_object_list
...
...
@@ -2729,6 +2731,7 @@ VALUES
# Add a new table to the catalog
sql_catalog
=
self
.
portal
.
portal_catalog
.
getSQLCatalog
()
sql_catalog
.
manage_setLocalRoles
(
user1
,
[
'Author'
,
'Auditor'
,
'Manager'
])
local_roles_table
=
"test_user_or_group_local_roles"
...
...
@@ -2742,22 +2745,22 @@ CREATE TABLE `%s` (
KEY `viewable_assignee_reference` (`viewable_assignee_reference`)
) ENGINE=InnoDB;
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z_create_%s'
%
local_roles_table
,
title
=
''
,
arguments
=
""
,
connection_id
=
'erp5_sql_connection'
,
template
=
create_local_role_table_sql
)
src
=
create_local_role_table_sql
)
drop_local_role_table_sql
=
"""
DROP TABLE IF EXISTS %s
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z0_drop_%s'
%
local_roles_table
,
title
=
''
,
arguments
=
""
,
connection_id
=
'erp5_sql_connection'
,
template
=
drop_local_role_table_sql
)
src
=
drop_local_role_table_sql
)
catalog_local_role_sql
=
"""
REPLACE INTO
...
...
@@ -2775,14 +2778,14 @@ VALUES
</dtml-if>
</dtml-in>
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z_catalog_%s_list'
%
local_roles_table
,
title
=
''
,
connection_id
=
'erp5_sql_connection'
,
arguments
=
"
\
n
"
.
join
([
'uid'
,
'getAssignee'
,
'getViewPermissionAssignee'
]),
template
=
catalog_local_role_sql
)
src
=
catalog_local_role_sql
)
self
.
commit
()
current_sql_catalog_object_list
=
sql_catalog
.
sql_catalog_object_list
...
...
@@ -2983,6 +2986,7 @@ VALUES
# Add a new table to the catalog
sql_catalog
=
self
.
portal
.
portal_catalog
.
getSQLCatalog
()
sql_catalog
.
manage_setLocalRoles
(
user1
,
[
'Author'
,
'Auditor'
,
'Manager'
])
local_roles_table
=
"another_test_user_or_group_local_roles"
...
...
@@ -2994,22 +2998,22 @@ CREATE TABLE `%s` (
KEY `viewable_assignee_reference` (`viewable_assignee_reference`)
) ENGINE=InnoDB;
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z_create_%s'
%
local_roles_table
,
title
=
''
,
arguments
=
""
,
connection_id
=
'erp5_sql_connection'
,
template
=
create_local_role_table_sql
)
src
=
create_local_role_table_sql
)
drop_local_role_table_sql
=
"""
DROP TABLE IF EXISTS %s
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z0_drop_%s'
%
local_roles_table
,
title
=
''
,
arguments
=
""
,
connection_id
=
'erp5_sql_connection'
,
template
=
drop_local_role_table_sql
)
src
=
drop_local_role_table_sql
)
catalog_local_role_sql
=
"""
REPLACE INTO
...
...
@@ -3026,13 +3030,13 @@ VALUES
</dtml-if>
</dtml-in>
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z_catalog_%s_list'
%
local_roles_table
,
title
=
''
,
connection_id
=
'erp5_sql_connection'
,
arguments
=
"
\
n
"
.
join
([
'uid'
,
'getViewPermissionAssignee'
]),
template
=
catalog_local_role_sql
)
src
=
catalog_local_role_sql
)
self
.
commit
()
current_sql_catalog_object_list
=
sql_catalog
.
sql_catalog_object_list
...
...
@@ -3223,22 +3227,22 @@ CREATE TABLE `%s` (
KEY `viewable_assignee_reference` (`viewable_assignee_reference`)
) ENGINE=InnoDB;
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z_create_%s'
%
local_roles_table
,
title
=
''
,
arguments
=
""
,
connection_id
=
'erp5_sql_connection'
,
template
=
create_local_role_table_sql
)
src
=
create_local_role_table_sql
)
drop_local_role_table_sql
=
"""
DROP TABLE IF EXISTS %s
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z0_drop_%s'
%
local_roles_table
,
title
=
''
,
arguments
=
""
,
connection_id
=
'erp5_sql_connection'
,
template
=
drop_local_role_table_sql
)
src
=
drop_local_role_table_sql
)
catalog_local_role_sql
=
"""
REPLACE INTO
...
...
@@ -3255,13 +3259,13 @@ VALUES
</dtml-if>
</dtml-in>
"""
%
local_roles_table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z_catalog_%s_list'
%
local_roles_table
,
title
=
''
,
connection_id
=
'erp5_sql_connection'
,
arguments
=
"
\
n
"
.
join
([
'uid'
,
'getViewPermissionAssignee'
]),
template
=
catalog_local_role_sql
)
src
=
catalog_local_role_sql
)
self
.
commit
()
current_sql_catalog_object_list
=
sql_catalog
.
sql_catalog_object_list
...
...
product/ERP5Catalog/tests/testERP5CatalogSecurityUidOptimization.py
View file @
7a9f6e3c
...
...
@@ -73,12 +73,12 @@ CREATE TABLE alternate_roles_and_users (
'alternate_roles_and_users'
]
# Configure sql method to insert this table
sql_catalog
.
manage_addProduct
[
'ZSQLMethods'
].
manage_addZSQLMethod
(
sql_catalog
.
newContent
(
portal_type
=
'SQL Method'
,
id
=
'z_catalog_alternate_roles_and_users_list'
,
title
=
''
,
connection_id
=
'erp5_sql_connection'
,
arguments
=
"
\
n
"
.
join
([
'uid'
,
'alternate_security_uid'
]),
template
=
"""REPLACE INTO alternate_roles_and_users VALUES
src
=
"""REPLACE INTO alternate_roles_and_users VALUES
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
( <dtml-sqlvar expr="uid[loop_item]" type="int">,
<dtml-sqlvar expr="alternate_security_uid[loop_item]" type="int" optional>
...
...
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