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
Leo Le Bouter
erp5
Commits
3cfd4565
Commit
3cfd4565
authored
Mar 06, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_config: Update tests for updating Business Manager
parent
4301bf87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
50 deletions
+68
-50
bt5/erp5_business_package/TestTemplateItem/portal_components/test.erp5.testBusinessPackage.py
...teItem/portal_components/test.erp5.testBusinessPackage.py
+68
-50
No files found.
bt5/erp5_business_package/TestTemplateItem/portal_components/test.erp5.testBusinessPackage.py
View file @
3cfd4565
...
@@ -71,6 +71,9 @@ class TestBusinessPackage(ERP5TypeTestCase):
...
@@ -71,6 +71,9 @@ class TestBusinessPackage(ERP5TypeTestCase):
self
.
export_dir
=
''
self
.
export_dir
=
''
self
.
portal
=
self
.
getPortalObject
()
self
.
portal
=
self
.
getPortalObject
()
# create dummy portal_type to be used in current live test
#self.portal.portal_type('')
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
try
:
try
:
package_id
=
self
.
package
.
getId
()
package_id
=
self
.
package
.
getId
()
...
@@ -131,7 +134,9 @@ class TestBusinessPackage(ERP5TypeTestCase):
...
@@ -131,7 +134,9 @@ class TestBusinessPackage(ERP5TypeTestCase):
bm_id
=
'manager_%s'
%
str
(
time
.
time
())
bm_id
=
'manager_%s'
%
str
(
time
.
time
())
if
not
title
:
if
not
title
:
title
=
bm_id
title
=
bm_id
manager
=
self
.
portal
.
portal_templates
.
newContent
(
id
=
bm_id
,
\
manager
=
self
.
portal
.
portal_templates
.
newContent
(
id
=
bm_id
,
title
=
title
,
portal_type
=
'Business Manager'
)
portal_type
=
'Business Manager'
)
self
.
tic
()
self
.
tic
()
return
manager
return
manager
...
@@ -273,46 +278,48 @@ class TestBusinessPackage(ERP5TypeTestCase):
...
@@ -273,46 +278,48 @@ class TestBusinessPackage(ERP5TypeTestCase):
managerA
=
self
.
_createBusinessManager
()
managerA
=
self
.
_createBusinessManager
()
managerB
=
self
.
_createBusinessManager
()
managerB
=
self
.
_createBusinessManager
()
test_catalog
=
self
.
portal
.
portal_catalog
.
newContent
(
test_folder
=
self
.
portal
.
newContent
(
portal_type
=
'Catalog'
,
id
=
'test_folder'
,
title
=
'Test Catalog initial for Multiple BM Installation'
,
portal_type
=
'Folder'
,
title
=
'couscous'
,
)
)
# Add catalog to the path list for Business Manager and build the object
# Add catalog to the path list for Business Manager and build the object
catalog_path
=
test_catalog
.
getRelativeUrl
()
folder_path
=
test_folder
.
getRelativeUrl
()
path_item_
catalog
=
'%s | %s | %s'
%
(
catalog
_path
,
1
,
1
)
path_item_
folder
=
'%s | %s | %s'
%
(
folder
_path
,
1
,
1
)
path_item_list
=
[
path_item_
catalog
]
path_item_list
=
[
path_item_
folder
]
# Set catalog path item as path_item in managerB
# Set catalog path item as path_item in managerB
managerB
.
_setTemplatePathList
(
path_item_list
)
managerB
.
_setTemplatePathList
(
path_item_list
)
# Build both Business Manager(s)
copy_data
=
portal_templates
.
manage_copyObjects
(
ids
=
[
built_manager_A
=
managerA
.
build
()
managerA
.
id
,
built_manager_B
=
managerB
.
build
()
managerB
.
id
,
])
result
=
portal_templates
.
manage_pasteObjects
(
copy_data
)
managerA_new_id
=
result
[
0
][
'new_id'
]
managerB_new_id
=
result
[
1
][
'new_id'
]
# Delete the catalog object
managerA_new
=
portal_templates
.
_getOb
(
managerA_new_id
)
self
.
portal
.
portal_catalog
.
manage_delObjects
(
managerB_new
=
portal_templates
.
_getOb
(
managerB_new_id
)
[
test_catalog
.
getId
(),])
# Test that the catalog don't exist on site anymore
managerA_new
.
build
()
self
.
assertRaises
(
KeyError
,
lambda
:
self
.
portal
.
restrictedTraverse
(
catalog_path
))
managerB_new
.
build
()
# Change the status of the new Business Manager objects as combined
# installation checks if the Business Manager has status 'uninstalled'
managerA_new
.
setStatus
(
'uninstalled'
)
managerB_new
.
setStatus
(
'uninstalled'
)
# Export the built Business Manager
# Delete the catalog object
exported_manager_path_B
=
self
.
_exportBusinessManager
(
built_manager_A
)
self
.
portal
.
manage_delObjects
([
test_folder
.
getId
(),])
exported_manager_path_A
=
self
.
_exportBusinessManager
(
built_manager_B
)
# Import the Business Managers
# Test that the catalog don't exist on site anymore
imported_manager_A
=
self
.
_importBusinessManager
(
managerA
,
self
.
assertRaises
(
KeyError
,
lambda
:
self
.
portal
.
restrictedTraverse
(
folder_path
))
exported_manager_path_A
,
increment
=
1
)
imported_manager_B
=
self
.
_importBusinessManager
(
managerB
,
exported_manager_path_B
,
increment
=
1
)
# Install both the Business Manager(s)
# Install both the Business Manager(s)
portal_templates
.
installMultipleBusinessManager
([
portal_templates
.
installMultipleBusinessManager
([
imported_manager_A
,
managerA_new
,
imported_manager_B
,
managerB_new
,
])
])
# XXX: Match the state of manager A and B, nothing extra added
# XXX: Match the state of manager A and B, nothing extra added
...
@@ -322,46 +329,57 @@ class TestBusinessPackage(ERP5TypeTestCase):
...
@@ -322,46 +329,57 @@ class TestBusinessPackage(ERP5TypeTestCase):
# ])
# ])
# Test that the catalog exists on ZODB after installation
# Test that the catalog exists on ZODB after installation
installed_test_
catalog
=
self
.
portal
.
restrictedTraverse
(
catalog
_path
)
installed_test_
folder
=
self
.
portal
.
restrictedTraverse
(
folder
_path
)
self
.
assertEquals
(
installed_test_
catalog
.
getTitle
(),
\
self
.
assertEquals
(
installed_test_
folder
.
getTitle
(),
'
Test Catalog initial for Multiple BM Installation
'
)
'
couscous
'
)
# Add catalog_path to managerA and remove the catalog_path from managerB
# Add catalog_path to managerA and remove the catalog_path from managerB
managerA
.
_setTemplatePathList
(
path_item_list
)
managerA
.
_setTemplatePathList
(
path_item_list
)
managerB
.
_setTemplatePathList
([])
managerB
.
_setTemplatePathList
([])
installed_test_catalog
.
edit
(
title
=
'new_couscous'
)
copy_data
=
portal_templates
.
manage_copyObjects
(
ids
=
[
managerA
.
id
,
managerB
.
id
,
])
result
=
portal_templates
.
manage_pasteObjects
(
copy_data
)
managerA_new_id
=
result
[
0
][
'new_id'
]
managerB_new_id
=
result
[
1
][
'new_id'
]
# Build both the Business Manager(s)
managerA_new
=
portal_templates
.
_getOb
(
managerA_new_id
)
built_manager_A
=
managerA
.
build
()
managerB_new
=
portal_templates
.
_getOb
(
managerB_new_id
)
built_manager_B
=
managerB
.
build
()
# Then we change the title of test catalog again
installed_test_folder
.
edit
(
title
=
'new_couscous'
)
installed_test_catalog
.
edit
(
title
=
'new_couscous_change_again'
)
# Build the new managers so that they do have the Business Item(s) defined
# in them properly
managerA_new
.
build
()
managerB_new
.
build
()
# Export the built Business Manager
# Change the status of the new Business Manager objects as combined
exported_manager_path_A
=
self
.
_exportBusinessManager
(
built_manager_A
)
# installation checks if the Business Manager has status 'uninstalled'
exported_manager_path_B
=
self
.
_exportBusinessManager
(
built_manager_B
)
managerA_new
.
setStatus
(
'uninstalled'
)
managerB_new
.
setStatus
(
'uninstalled'
)
# Import the Business Managers
# Then we change the title of test catalog again
imported_manager_A
=
self
.
_importBusinessManager
(
managerA
,
installed_test_folder
.
edit
(
title
=
'new_couscous_change_again'
)
exported_manager_path_A
,
increment
=
2
)
imported_manager_B
=
self
.
_importBusinessManager
(
managerB
,
exported_manager_path_B
,
increment
=
2
)
# Match the overall state,
# Match the overall state,
# Install both the Business Manager(s)
# Install both the Business Manager(s)
portal_templates
.
installMultipleBusinessManager
([
portal_templates
.
installMultipleBusinessManager
([
imported_manager_A
,
managerA_new
,
imported_manager_B
,
managerB_new
,
])
])
# Test that the catalog exists on ZODB after installation with the newer
# Test that the catalog exists on ZODB after installation with the newer
# updated version
# updated version
catalog
=
self
.
portal
.
restrictedTraverse
(
installed_test_catalog
.
getRelativeUrl
())
test_folder
=
self
.
portal
.
restrictedTraverse
(
installed_test_folder
.
getRelativeUrl
())
self
.
assertEquals
(
catalog
.
getTitle
(),
"new_couscous"
)
self
.
assertEquals
(
test_folder
.
getTitle
(),
"new_couscous"
)
# Delete the test folder created at the path if it exists there
try
:
self
.
portal
.
manage_delObjects
([
test_folder
.
getId
(),])
except
Exception
:
pass
def
_UpdateVersionOfBusinessManager
(
self
):
def
_UpdateVersionOfBusinessManager
(
self
):
"""
"""
...
...
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