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
Noah Brackenbury
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):
self
.
export_dir
=
''
self
.
portal
=
self
.
getPortalObject
()
# create dummy portal_type to be used in current live test
#self.portal.portal_type('')
def
beforeTearDown
(
self
):
try
:
package_id
=
self
.
package
.
getId
()
...
...
@@ -131,7 +134,9 @@ class TestBusinessPackage(ERP5TypeTestCase):
bm_id
=
'manager_%s'
%
str
(
time
.
time
())
if
not
title
:
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'
)
self
.
tic
()
return
manager
...
...
@@ -273,46 +278,48 @@ class TestBusinessPackage(ERP5TypeTestCase):
managerA
=
self
.
_createBusinessManager
()
managerB
=
self
.
_createBusinessManager
()
test_catalog
=
self
.
portal
.
portal_catalog
.
newContent
(
portal_type
=
'Catalog'
,
title
=
'Test Catalog initial for Multiple BM Installation'
,
test_folder
=
self
.
portal
.
newContent
(
id
=
'test_folder'
,
portal_type
=
'Folder'
,
title
=
'couscous'
,
)
# Add catalog to the path list for Business Manager and build the object
catalog_path
=
test_catalog
.
getRelativeUrl
()
path_item_
catalog
=
'%s | %s | %s'
%
(
catalog
_path
,
1
,
1
)
path_item_list
=
[
path_item_
catalog
]
folder_path
=
test_folder
.
getRelativeUrl
()
path_item_
folder
=
'%s | %s | %s'
%
(
folder
_path
,
1
,
1
)
path_item_list
=
[
path_item_
folder
]
# Set catalog path item as path_item in managerB
managerB
.
_setTemplatePathList
(
path_item_list
)
# Build both Business Manager(s)
built_manager_A
=
managerA
.
build
()
built_manager_B
=
managerB
.
build
()
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'
]
# Delete the catalog object
self
.
portal
.
portal_catalog
.
manage_delObjects
(
[
test_catalog
.
getId
(),])
managerA_new
=
portal_templates
.
_getOb
(
managerA_new_id
)
managerB_new
=
portal_templates
.
_getOb
(
managerB_new_id
)
# Test that the catalog don't exist on site anymore
self
.
assertRaises
(
KeyError
,
lambda
:
self
.
portal
.
restrictedTraverse
(
catalog_path
))
managerA_new
.
build
()
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
exported_manager_path_B
=
self
.
_exportBusinessManager
(
built_manager_A
)
exported_manager_path_A
=
self
.
_exportBusinessManager
(
built_manager_B
)
# Delete the catalog object
self
.
portal
.
manage_delObjects
([
test_folder
.
getId
(),])
# Import the Business Managers
imported_manager_A
=
self
.
_importBusinessManager
(
managerA
,
exported_manager_path_A
,
increment
=
1
)
imported_manager_B
=
self
.
_importBusinessManager
(
managerB
,
exported_manager_path_B
,
increment
=
1
)
# Test that the catalog don't exist on site anymore
self
.
assertRaises
(
KeyError
,
lambda
:
self
.
portal
.
restrictedTraverse
(
folder_path
))
# Install both the Business Manager(s)
portal_templates
.
installMultipleBusinessManager
([
imported_manager_A
,
imported_manager_B
,
managerA_new
,
managerB_new
,
])
# XXX: Match the state of manager A and B, nothing extra added
...
...
@@ -322,46 +329,57 @@ class TestBusinessPackage(ERP5TypeTestCase):
# ])
# Test that the catalog exists on ZODB after installation
installed_test_
catalog
=
self
.
portal
.
restrictedTraverse
(
catalog
_path
)
self
.
assertEquals
(
installed_test_
catalog
.
getTitle
(),
\
'
Test Catalog initial for Multiple BM Installation
'
)
installed_test_
folder
=
self
.
portal
.
restrictedTraverse
(
folder
_path
)
self
.
assertEquals
(
installed_test_
folder
.
getTitle
(),
'
couscous
'
)
# Add catalog_path to managerA and remove the catalog_path from managerB
managerA
.
_setTemplatePathList
(
path_item_list
)
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)
built_manager_A
=
managerA
.
build
()
built_manager_B
=
managerB
.
build
()
managerA_new
=
portal_templates
.
_getOb
(
managerA_new_id
)
managerB_new
=
portal_templates
.
_getOb
(
managerB_new_id
)
# Then we change the title of test catalog again
installed_test_catalog
.
edit
(
title
=
'new_couscous_change_again'
)
installed_test_folder
.
edit
(
title
=
'new_couscous'
)
# 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
exported_manager_path_A
=
self
.
_exportBusinessManager
(
built_manager_A
)
exported_manager_path_B
=
self
.
_exportBusinessManager
(
built_manager_B
)
# 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'
)
# Import the Business Managers
imported_manager_A
=
self
.
_importBusinessManager
(
managerA
,
exported_manager_path_A
,
increment
=
2
)
imported_manager_B
=
self
.
_importBusinessManager
(
managerB
,
exported_manager_path_B
,
increment
=
2
)
# Then we change the title of test catalog again
installed_test_folder
.
edit
(
title
=
'new_couscous_change_again'
)
# Match the overall state,
# Install both the Business Manager(s)
portal_templates
.
installMultipleBusinessManager
([
imported_manager_A
,
imported_manager_B
,
managerA_new
,
managerB_new
,
])
# Test that the catalog exists on ZODB after installation with the newer
# updated version
catalog
=
self
.
portal
.
restrictedTraverse
(
installed_test_catalog
.
getRelativeUrl
())
self
.
assertEquals
(
catalog
.
getTitle
(),
"new_couscous"
)
test_folder
=
self
.
portal
.
restrictedTraverse
(
installed_test_folder
.
getRelativeUrl
())
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
):
"""
...
...
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