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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Georgios Dagkakis
erp5
Commits
c9c5dbf4
Commit
c9c5dbf4
authored
Jun 13, 2018
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Temp commit of BT installation test
parent
3bdde386
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
product/ERP5/tests/testBusinessTemplate.py
product/ERP5/tests/testBusinessTemplate.py
+70
-0
No files found.
product/ERP5/tests/testBusinessTemplate.py
View file @
c9c5dbf4
...
...
@@ -6862,6 +6862,76 @@ class TestBusinessTemplate(BusinessTemplateMixin):
{
'test_document'
:
(
'Removed but should be kept'
,
'Path'
)},
new_bt
.
preinstall
())
def
test_update_business_template_with_category_having_subcategory_tree_modified
(
self
):
"""Tries to reproduce the bug of having portal/portal_categories/test_category/foo with
two sub-categories '1' and '2'. If a sub-object in '1' is modified and
'2' is removed then upgrading the template failed because:
- CategoryTemplateItem creates a trash object for '2' first
- PathTemplateItem does not re-create '1' when it re-installs the
Parent Category ('foo')
"""
portal_categories
=
self
.
portal
.
portal_categories
base_category_id
=
'test_category'
if
base_category_id
in
portal_categories
.
objectIds
():
portal_categories
.
manage_delObjects
([
base_category_id
])
base_category
=
portal_categories
.
newContent
(
portal_type
=
'Base Category'
,
id
=
base_category_id
)
parent_category
=
base_category
.
newContent
(
portal_type
=
'Category'
,
id
=
'foo'
)
parent_category
.
newContent
(
portal_type
=
'Category'
,
id
=
'1'
)
parent_category
.
newContent
(
portal_type
=
'Category'
,
id
=
'2'
)
parent_category
[
'1'
].
newContent
(
portal_type
=
'Category'
,
id
=
'10'
)
business_template
=
self
.
portal
.
portal_templates
.
newContent
(
portal_type
=
'Business Template'
,
title
=
self
.
id
(),
template_path_list
=
(
'portal_categories/'
+
base_category_id
,
'portal_categories/'
+
base_category_id
+
'/**'
),
template_base_category_list
=
[
base_category_id
],
)
self
.
tic
()
business_template
.
build
()
self
.
tic
()
export_dir
=
tempfile
.
mkdtemp
()
try
:
business_template
.
export
(
path
=
export_dir
,
local
=
True
)
self
.
tic
()
new_business_template_version_1
=
self
.
portal
.
portal_templates
.
download
(
url
=
'file://%s'
%
export_dir
)
finally
:
shutil
.
rmtree
(
export_dir
)
# Modify parent category
parent_category
.
setTitle
(
'Title for FOO'
)
# Add a child to '1'
parent_category
[
'1'
].
newContent
(
portal_type
=
'Category'
,
id
=
'11'
)
# Delete '2'
parent_category
.
manage_delObjects
([
'2'
])
business_template
=
self
.
portal
.
portal_templates
.
newContent
(
portal_type
=
'Business Template'
,
title
=
self
.
id
(),
template_path_list
=
(
'portal_categories/'
+
base_category_id
,
'portal_categories/'
+
base_category_id
+
'/**'
),
template_base_category_list
=
[
base_category_id
],
)
self
.
tic
()
business_template
.
build
()
self
.
tic
()
export_dir
=
tempfile
.
mkdtemp
()
try
:
business_template
.
export
(
path
=
export_dir
,
local
=
True
)
self
.
tic
()
self
.
portal
.
portal_categories
.
manage_delObjects
([
base_category_id
])
new_business_template_version_1
.
install
()
self
.
tic
()
self
.
portal
.
portal_templates
.
updateBusinessTemplateFromUrl
(
download_url
=
'file://%s'
%
export_dir
)
# Fails with KeyError: '1'
finally
:
shutil
.
rmtree
(
export_dir
)
def
test_update_business_template_with_template_keep_path_list_catalog_method
(
self
):
"""Tests for `template_keep_path_list` feature for the special case of catalog methods
"""
...
...
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