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
Mikolaï Krol
erp5
Commits
b7fc2908
Commit
b7fc2908
authored
Feb 06, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for Extension Component bt5 migration from filesystem to ZODB.
parent
619145d2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
108 additions
and
0 deletions
+108
-0
product/ERP5/tests/testBusinessTemplate.py
product/ERP5/tests/testBusinessTemplate.py
+108
-0
No files found.
product/ERP5/tests/testBusinessTemplate.py
View file @
b7fc2908
...
@@ -6869,6 +6869,8 @@ class TestConstraintTemplateItem(TestDocumentTemplateItem):
...
@@ -6869,6 +6869,8 @@ class TestConstraintTemplateItem(TestDocumentTemplateItem):
document_base_path
=
os
.
path
.
join
(
getConfiguration
().
instancehome
,
'Constraint'
)
document_base_path
=
os
.
path
.
join
(
getConfiguration
().
instancehome
,
'Constraint'
)
template_property
=
'template_constraint_id_list'
template_property
=
'template_constraint_id_list'
from
Products.ERP5Type.Core.ExtensionComponent
import
ExtensionComponent
class
TestExtensionTemplateItem
(
TestDocumentTemplateItem
):
class
TestExtensionTemplateItem
(
TestDocumentTemplateItem
):
document_title
=
'UnitTest'
document_title
=
'UnitTest'
document_data
=
"""class UnitTest:
document_data
=
"""class UnitTest:
...
@@ -6882,6 +6884,112 @@ class TestExtensionTemplateItem(TestDocumentTemplateItem):
...
@@ -6882,6 +6884,112 @@ class TestExtensionTemplateItem(TestDocumentTemplateItem):
document_base_path
=
os
.
path
.
join
(
getConfiguration
().
instancehome
,
'Extensions'
)
document_base_path
=
os
.
path
.
join
(
getConfiguration
().
instancehome
,
'Extensions'
)
template_property
=
'template_extension_id_list'
template_property
=
'template_extension_id_list'
component_module
=
ExtensionComponent
.
_getDynamicModuleNamespace
()
component_portal_type
=
ExtensionComponent
.
portal_type
def
getBusinessTemplateList
(
self
):
return
(
super
(
TestExtensionTemplateItem
,
self
).
getBusinessTemplateList
()
+
(
'erp5_core_component'
,))
def
stepCheckZodbDocumentRemoved
(
self
,
sequence
=
None
,
**
kw
):
component_tool
=
self
.
getPortalObject
().
portal_components
component_id
=
'erp5.component.extension.'
+
sequence
[
'document_title'
]
self
.
failIf
(
component_id
in
component_tool
.
objectIds
())
def
stepRemoveZodbDocument
(
self
,
sequence
=
None
,
**
kw
):
"""
Remove Property Sheet, but only from ZODB
"""
component_id
=
'%s.%s'
%
(
self
.
component_module
,
sequence
[
'document_title'
])
self
.
portal
.
portal_components
.
manage_delObjects
([
component_id
])
def
stepCheckDocumentMigration
(
self
,
sequence
=
None
,
**
kw
):
"""
Check migration of Document from the Filesystem to ZODB
"""
component_id
=
'%s.%s'
%
(
self
.
component_module
,
sequence
[
'document_title'
])
component_tool
=
self
.
getPortalObject
().
portal_components
self
.
failUnless
(
component_id
in
component_tool
.
objectIds
())
component
=
getattr
(
component_tool
,
component_id
)
self
.
assertEquals
(
component
.
getReference
(),
self
.
document_title
)
self
.
assertEquals
(
component
.
getTextContent
(),
self
.
document_data
)
self
.
assertEquals
(
component
.
getPortalType
(),
self
.
component_portal_type
)
def
stepCheckForkedMigrationExport
(
self
,
sequence
=
None
,
**
kw
):
component_bt_tool_path
=
os
.
path
.
join
(
sequence
[
'template_path'
],
'ExtensionTemplateItem'
,
'portal_components'
)
self
.
assertTrue
(
os
.
path
.
exists
(
component_bt_tool_path
))
component_id
=
'%s.%s'
%
(
self
.
component_module
,
sequence
[
'document_title'
])
base_path
=
os
.
path
.
join
(
component_bt_tool_path
,
component_id
)
python_source_code_path
=
base_path
+
'.py'
self
.
assertTrue
(
os
.
path
.
exists
(
python_source_code_path
))
source_code
=
sequence
[
'document_data'
]
with
open
(
python_source_code_path
)
as
f
:
self
.
assertEquals
(
f
.
read
(),
source_code
)
xml_path
=
base_path
+
'.xml'
self
.
assertTrue
(
os
.
path
.
exists
(
xml_path
))
first_line
=
source_code
.
split
(
'
\
n
'
,
1
)[
0
]
with
open
(
xml_path
)
as
f
:
for
line
in
f
:
self
.
failIf
(
first_line
in
line
)
def
test_BusinessTemplateWithDocumentMigration
(
self
):
sequence_list
=
SequenceList
()
sequence_string
=
'
\
CreateDocument
\
CreateNewBusinessTemplate
\
UseExportBusinessTemplate
\
AddDocumentToBusinessTemplate
\
CheckModifiedBuildingState
\
CheckNotInstalledInstallationState
\
BuildBusinessTemplate
\
CheckBuiltBuildingState
\
CheckNotInstalledInstallationState
\
CheckObjectPropertiesInBusinessTemplate
\
SaveBusinessTemplate
\
CheckBuiltBuildingState
\
CheckNotInstalledInstallationState
\
RemoveDocument
\
RemoveBusinessTemplate
\
RemoveAllTrashBins
\
ImportBusinessTemplate
\
UseImportBusinessTemplate
\
CheckBuiltBuildingState
\
CheckNotInstalledInstallationState
\
InstallWithoutForceBusinessTemplate
\
Tic
\
CheckInstalledInstallationState
\
CheckBuiltBuildingState
\
CheckNoTrashBin
\
CheckSkinsLayers
\
CheckDocumentMigration
\
CheckDocumentRemoved
\
UninstallBusinessTemplate
\
CheckBuiltBuildingState
\
CheckNotInstalledInstallationState
\
CheckZodbDocumentRemoved
\
SaveBusinessTemplate
\
CheckForkedMigrationExport
\
'
sequence_list
.
addSequenceString
(
sequence_string
)
# XXX-arnau: Temporary until _perform_migration is set to True by default
from
Products.ERP5.Document.BusinessTemplate
import
ExtensionTemplateItem
ExtensionTemplateItem
.
_perform_migration
=
True
try
:
sequence_list
.
play
(
self
)
finally
:
ExtensionTemplateItem
.
_perform_migration
=
False
class
TestTestTemplateItem
(
TestDocumentTemplateItem
):
class
TestTestTemplateItem
(
TestDocumentTemplateItem
):
document_title
=
'UnitTest'
document_title
=
'UnitTest'
document_data
=
"""class UnitTest:
document_data
=
"""class UnitTest:
...
...
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