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
Matevz Golob
erp5
Commits
60a56a3c
Commit
60a56a3c
authored
Jan 06, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_prototype: Update portal component tests
parent
e6403cdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
3 deletions
+49
-3
bt5/erp5_business_package/TestTemplateItem/portal_components/test.erp5.testBusinessPackage.py
...teItem/portal_components/test.erp5.testBusinessPackage.py
+49
-3
No files found.
bt5/erp5_business_package/TestTemplateItem/portal_components/test.erp5.testBusinessPackage.py
View file @
60a56a3c
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
import
time
import
time
from
Products.ERP5.Document.BusinessPackage
import
InstallationTree
,
createInstallationData
class
TestBusinessPackage
(
ERP5TypeTestCase
):
class
TestBusinessPackage
(
ERP5TypeTestCase
):
"""
"""
...
@@ -65,6 +66,7 @@ class TestBusinessPackage(ERP5TypeTestCase):
...
@@ -65,6 +66,7 @@ class TestBusinessPackage(ERP5TypeTestCase):
# here, you can create the categories and objects your test will depend on
# here, you can create the categories and objects your test will depend on
#self.export_dir = tempfile.mkdtmp(dir=tests_home)
#self.export_dir = tempfile.mkdtmp(dir=tests_home)
self
.
portal
=
self
.
getPortalObject
()
self
.
portal
=
self
.
getPortalObject
()
self
.
installation_tree
=
InstallationTree
()
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
try
:
try
:
...
@@ -108,7 +110,9 @@ class TestBusinessPackage(ERP5TypeTestCase):
...
@@ -108,7 +110,9 @@ class TestBusinessPackage(ERP5TypeTestCase):
def
test_fileImportAndReinstallForDocument
(
self
):
def
test_fileImportAndReinstallForDocument
(
self
):
"""
"""
Test Business Package build and install with test document
Test Business Package build and install with test document.
Expected result: Installs the exported object to the path expected on site.
"""
"""
package
=
self
.
_createBusinessPackage
()
package
=
self
.
_createBusinessPackage
()
document_file
=
self
.
portal
.
document_module
.
newContent
(
document_file
=
self
.
portal
.
document_module
.
newContent
(
...
@@ -142,6 +146,48 @@ class TestBusinessPackage(ERP5TypeTestCase):
...
@@ -142,6 +146,48 @@ class TestBusinessPackage(ERP5TypeTestCase):
def
test_sameFileImportAndReinstallOnTwoPackages
(
self
):
def
test_sameFileImportAndReinstallOnTwoPackages
(
self
):
"""
"""
Test two Business Packages build and installation of same file
Test two Business Packages build and installation of same file.
Expected result: If we install same object from 2 different business packages,
then in that case the installation object should compare between the
state of OFS and installation and install accordingly.
"""
"""
self
.
assertEquals
(
1
,
1
)
old_package
=
self
.
_createBusinessPackage
()
new_package
=
self
.
_createBusinessPackage
()
document_file
=
self
.
portal
.
document_module
.
newContent
(
portal_type
=
'File'
,
title
=
'Test Document'
,
reference
=
'erp5-package.Test.Document.Two.BP'
,
data
=
'test file'
,
content_type
=
None
)
self
.
tic
()
file_path
=
document_file
.
getRelativeUrl
()
old_package
.
edit
(
template_path_list
=
[
file_path
,])
new_package
.
edit
(
template_path_list
=
[
file_path
,])
self
.
tic
()
# Build both the packages
self
.
_buildAndExportBusinessPackage
(
old_package
)
self
.
_buildAndExportBusinessPackage
(
new_package
)
self
.
tic
()
# Get installation data from the list of packages which we want to install
package_list
=
[
old_package
,
new_package
]
data
=
createInstallationData
(
package_list
)
# creat InstallationTree object
installation_tree
=
InstallationTree
(
data
)
# Delete document from site
self
.
portal
.
document_module
.
manage_delObjects
([
document_file
.
getId
(),])
self
.
tic
()
# Test if the file doesn't exist on site anymore
self
.
assertRaises
(
KeyError
,
lambda
:
self
.
portal
.
restrictedTraverse
(
file_path
))
# We try to install pakcages via mapping the installation tree to ZODB
# As both have exactly same document we expect that only one of them get installed
installation_tree
.
map
()
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