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
904a5f0a
Commit
904a5f0a
authored
Jan 04, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_prototype: Add live test for testing Business Package
parent
431f7758
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
261 additions
and
0 deletions
+261
-0
product/ERP5/bootstrap/erp5_business_package/TestTemplateItem/portal_components/test.erp5.testBusinessPackage.py
...teItem/portal_components/test.erp5.testBusinessPackage.py
+137
-0
product/ERP5/bootstrap/erp5_business_package/TestTemplateItem/portal_components/test.erp5.testBusinessPackage.xml
...eItem/portal_components/test.erp5.testBusinessPackage.xml
+123
-0
product/ERP5/bootstrap/erp5_business_package/bt/template_test_id_list
.../bootstrap/erp5_business_package/bt/template_test_id_list
+1
-0
No files found.
product/ERP5/bootstrap/erp5_business_package/TestTemplateItem/portal_components/test.erp5.testBusinessPackage.py
0 → 100644
View file @
904a5f0a
##############################################################################
#
# Copyright (c) 2002-2017 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
import
tempfile
from
Products.ERP5Type.tests.runUnitTest
import
tests_home
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
class
TestBusinessPackage
(
ERP5TypeTestCase
):
"""
Test class to test that Business Package object can export some paths
and install them on an erp5 site
Steps:
- Create BusinessPackage object
- Add path list to the object
- Build the package and expect the items mentioned in path list gets
exported in the build step
- Remove the objects mentioned in path_list from the site
- Install the package
- Expected result should be that it installs the objects on the site
"""
def
getTitle
(
self
):
return
"TestBusinessPackage"
def
getBusinessTemplateList
(
self
):
"""
Tuple of Business Templates we need to install
"""
return
(
'erp5_base'
,
'erp5_business_package'
,
)
def
afterSetUp
(
self
):
"""
This is ran before anything, used to set the environment
"""
# here, you can create the categories and objects your test will depend on
self
.
export_dir
=
tempfile
.
mkdtmp
(
dir
=
tests_home
)
self
.
portal
=
self
.
getPortalObject
()
self
.
package
=
self
.
_createBusinessPackage
()
def
beforeTearDown
(
self
):
try
:
package_id
=
self
.
package
.
getId
()
if
package_id
:
self
.
portal
.
manage_delObjects
([
package_id
,])
except
AttributeError
:
pass
def
_createBusinessPackage
(
self
):
package
=
self
.
portal
.
newContent
(
portal_type
=
'Business Package'
)
self
.
assertTrue
(
package
.
getBuildingState
()
==
'draft'
)
self
.
assertTrue
(
package
.
getInstallationState
()
==
'not_installed'
)
package
.
edit
(
title
=
'test_package'
,
version
=
'1.0'
,
description
=
'package for live test'
)
return
package
def
_buildAndExportBusinessPackage
(
self
):
"""
Builds and exports Business Package to a given export directory
"""
# Build Package
# Expected result should be while building the path object items
# are going to be exported as XML(?)
self
.
tic
()
self
.
built_package
=
self
.
package
.
build
()
self
.
tic
()
# Export package (not needed)
#self.package.export(path=self.export_dir, local=True)
#self.tic()
def
_installBusinessPackage
(
self
):
"""
Install the package from its built version.
Expected to install the PathTemplateObject items
"""
self
.
package
.
install
()
def
test_fileImportAndReinstallForDocument
(
self
):
"""
Test Business Package build and install with test document
"""
document_file
=
self
.
portal
.
document_module
.
newContent
(
portal_type
=
'File'
,
title
=
'Test Document'
,
reference
=
'erp5-package.Test.Document'
,
data
=
'test file'
,
content_type
=
None
)
self
.
tic
()
file_path
=
document_file
.
getRelativeUrl
()
self
.
package
.
edit
(
template_path_list
=
[
file_path
,])
# Build package
self
.
_buildAndExportBusinessPackage
()
# Delete document from site
self
.
portal
.
document_module
.
manage_delObjects
([
document_file
.
getId
(),])
self
.
tic
()
# Test if the file is gone
self
.
assertIsNone
(
self
.
portal
.
restrictedTraverse
(
file_path
))
# Install package
self
.
_installBusinessPackage
()
# Test if the file is back
self
.
assertIsNotNone
(
self
.
portal
.
restrictedTraverse
(
file_path
))
product/ERP5/bootstrap/erp5_business_package/TestTemplateItem/portal_components/test.erp5.testBusinessPackage.xml
0 → 100644
View file @
904a5f0a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testBusinessPackage
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testBusinessPackage
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_business_package/bt/template_test_id_list
0 → 100644
View file @
904a5f0a
test.erp5.testBusinessPackage
\ No newline at end of file
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