Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
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
Paul Graydon
wendelin
Commits
f42656ed
Commit
f42656ed
authored
Jan 22, 2025
by
Paul Graydon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_wendelin: Add tests for shared Data Analysis creation
parent
7bde33a8
Pipeline
#39197
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
106 additions
and
2 deletions
+106
-2
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.py
...tTemplateItem/portal_components/test.erp5.testWendelin.py
+106
-2
No files found.
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.py
View file @
f42656ed
...
@@ -446,6 +446,7 @@ class Test(ERP5TypeTestCase):
...
@@ -446,6 +446,7 @@ class Test(ERP5TypeTestCase):
source_section
=
data_supply
.
getSourceSection
(),
source_section
=
data_supply
.
getSourceSection
(),
destination
=
"organisation_module/test_wendelin_destination"
,
destination
=
"organisation_module/test_wendelin_destination"
,
destination_section
=
"organisation_module/test_wendelin_destination_section"
,
destination_section
=
"organisation_module/test_wendelin_destination_section"
,
destination_project
=
data_supply
.
getDestinationProject
(),
start_date
=
data_supply
.
getCreationDate
())
start_date
=
data_supply
.
getCreationDate
())
self
.
addCleanup
(
self
.
_removeDocument
,
data_ingestion
)
self
.
addCleanup
(
self
.
_removeDocument
,
data_ingestion
)
...
@@ -474,7 +475,7 @@ class Test(ERP5TypeTestCase):
...
@@ -474,7 +475,7 @@ class Test(ERP5TypeTestCase):
return
data_ingestion
return
data_ingestion
def
test_10_DataAnalysesCreation
(
self
):
def
test_10_
1_
DataAnalysesCreation
(
self
):
"""
"""
Test data ingestion and analyses execution.
Test data ingestion and analyses execution.
"""
"""
...
@@ -527,6 +528,110 @@ class Test(ERP5TypeTestCase):
...
@@ -527,6 +528,110 @@ class Test(ERP5TypeTestCase):
self
.
assertEqual
(
len
(
data_transformation
.
objectValues
()),
self
.
assertEqual
(
len
(
data_transformation
.
objectValues
()),
len
(
to_delete_data_analysis
.
objectValues
()))
len
(
to_delete_data_analysis
.
objectValues
()))
self
.
assertEqual
(
"started"
,
to_delete_data_analysis
.
getSimulationState
())
self
.
assertEqual
(
"started"
,
to_delete_data_analysis
.
getSimulationState
())
def
test_10_2_sharedDataAnalysesCreationEnabled
(
self
,
enable_pref
=
True
):
"""
Test that Data Analysis creation correctly takes into account the
the 'Enable Data Analysis Sharing' Wendelin system preference.
"""
portal
=
self
.
portal
# Set the system preference
default_system_preference
=
getattr
(
portal
.
portal_preferences
,
'default_system_preference'
,
None
)
default_system_preference
.
setPreferredEnableDataAnalysisSharing
(
enable_pref
)
self
.
tic
()
self
.
assertEqual
(
default_system_preference
.
getPreferenceState
(),
'global'
)
self
.
assertEqual
(
default_system_preference
.
getPreferredEnableDataAnalysisSharing
(),
enable_pref
)
# test DataSupply_viewAddRelatedDataIngestionActionDialog dialog
# this test code will create a Data Ingestion which itself will
# be used in later tests of ERP5Site_createDataAnalysisList
data_supply_1
=
portal
.
data_supply_module
.
test_10_sharedDataAnalysesCreation_data_supply_1
data_supply_2
=
portal
.
data_supply_module
.
test_10_sharedDataAnalysesCreation_data_supply_2
data_ingestion_1
=
self
.
_addDataIngestionToDataSupply
(
data_supply_1
)
self
.
assertNotEqual
(
None
,
data_ingestion_1
)
self
.
tic
()
before_data_analysis_list
=
portal
.
portal_catalog
(
portal_type
=
"Data Analysis"
,
simulation_state
=
"started"
)
# create first DA from first DI
portal
.
ERP5Site_createDataAnalysisList
()
self
.
tic
()
data_ingestion_2
=
self
.
_addDataIngestionToDataSupply
(
data_supply_2
)
self
.
assertNotEqual
(
None
,
data_ingestion_2
)
self
.
tic
()
# create second DA from second DI
portal
.
ERP5Site_createDataAnalysisList
()
self
.
tic
()
after_data_analysis_list
=
portal
.
portal_catalog
(
portal_type
=
"Data Analysis"
,
simulation_state
=
"started"
)
before_data_analysis_list
=
set
([
x
.
getObject
()
for
x
in
before_data_analysis_list
])
after_data_analysis_list
=
set
([
x
.
getObject
()
for
x
in
after_data_analysis_list
])
new_data_analysis_count
=
1
if
enable_pref
else
2
self
.
assertEqual
(
new_data_analysis_count
,
len
(
after_data_analysis_list
)
-
len
(
before_data_analysis_list
))
to_delete_data_analysis_set
=
after_data_analysis_list
-
before_data_analysis_list
to_delete_data_analysis_list
=
[
data_analysis
for
data_analysis
in
to_delete_data_analysis_set
\
if
data_analysis
.
getCausalityValue
()
in
[
data_ingestion_1
,
data_ingestion_2
]
]
for
data_analysis
in
to_delete_data_analysis_list
:
self
.
addCleanup
(
self
.
_removeDocument
,
data_analysis
)
data_transformation
=
portal
.
data_transformation_module
.
test_wendelin_data_transformation
if
enable_pref
:
data_analysis
=
to_delete_data_analysis_list
[
0
]
self
.
assertSameSet
(
[
data_ingestion_1
,
data_ingestion_2
],
data_analysis
.
getCausalityValueList
()
)
self
.
assertSameSet
(
[
data_supply_1
,
data_supply_2
,
data_transformation
],
data_analysis
.
getSpecialiseValueList
()
)
# all lines should be properly created
self
.
assertEqual
(
len
(
data_transformation
.
objectValues
())
+
1
,
len
(
data_analysis
.
objectValues
()))
self
.
assertEqual
(
"started"
,
data_analysis
.
getSimulationState
())
else
:
data_analysis_1
=
None
data_analysis_2
=
None
# List may not be in consistent order due to being created from sets
for
data_analysis
in
to_delete_data_analysis_list
:
if
data_analysis
.
getCausalityValue
()
==
data_ingestion_1
:
data_analysis_1
=
data_analysis
elif
data_analysis
.
getCausalityValue
()
==
data_ingestion_2
:
data_analysis_2
=
data_analysis
self
.
assertEqual
(
data_ingestion_1
,
data_analysis_1
.
getCausalityValue
())
self
.
assertEqual
(
data_ingestion_2
,
data_analysis_2
.
getCausalityValue
())
self
.
assertSameSet
(
[
data_supply_1
,
data_transformation
],
data_analysis_1
.
getSpecialiseValueList
()
)
self
.
assertSameSet
(
[
data_supply_2
,
data_transformation
],
data_analysis_2
.
getSpecialiseValueList
()
)
# all lines should be properly created
self
.
assertEqual
(
len
(
data_transformation
.
objectValues
()),
len
(
data_analysis_1
.
objectValues
()))
self
.
assertEqual
(
"started"
,
data_analysis_1
.
getSimulationState
())
self
.
assertEqual
(
len
(
data_transformation
.
objectValues
()),
len
(
data_analysis_2
.
objectValues
()))
self
.
assertEqual
(
"started"
,
data_analysis_2
.
getSimulationState
())
def
test_10_3_sharedDataAnalysesCreationDisabled
(
self
):
self
.
test_10_2_sharedDataAnalysesCreationEnabled
(
enable_pref
=
False
)
def
test_11_temporaryDataArray
(
self
):
def
test_11_temporaryDataArray
(
self
):
"""
"""
...
@@ -870,7 +975,6 @@ result = [x for x in data_bucket_stream.getBucketIndexKeySequenceByIndex()]
...
@@ -870,7 +975,6 @@ result = [x for x in data_bucket_stream.getBucketIndexKeySequenceByIndex()]
[
'/usr/bin/R'
,
'b4c48d52345ae2eb7ca0455db'
,
'59441ddbc00b6521da571'
,
'a92be1a7acc03f3846'
],
[
'/usr/bin/R'
,
'b4c48d52345ae2eb7ca0455db'
,
'59441ddbc00b6521da571'
,
'a92be1a7acc03f3846'
],
[
'/usr/bin/Rscript'
,
'e97842e556f90be5f7e5'
,
'806725443a01bcae802'
,
'1829d887e0c3380ec8f463527'
]])
[
'/usr/bin/Rscript'
,
'e97842e556f90be5f7e5'
,
'806725443a01bcae802'
,
'1829d887e0c3380ec8f463527'
]])
def
test_18_wendelinTextToNumpySecurity
(
self
):
def
test_18_wendelinTextToNumpySecurity
(
self
):
"""
"""
Test that we do not load pickles when converting encoded wendelin data to numpy.
Test that we do not load pickles when converting encoded wendelin data to numpy.
...
...
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