Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.core
Commits
ccbf6e16
Commit
ccbf6e16
authored
Mar 23, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
Improve code for stable assertions
See merge request
nexedi/slapos.core!615
parents
90f756ea
926841f6
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
508 additions
and
471 deletions
+508
-471
master/bt5/slapos_abyss/TestTemplateItem/portal_components/test.erp5.testSlapOSAbyss.py
...mplateItem/portal_components/test.erp5.testSlapOSAbyss.py
+100
-100
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingBuilder.py
...ortal_components/test.erp5.testSlapOSAccountingBuilder.py
+2
-2
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingConstraint.py
...al_components/test.erp5.testSlapOSAccountingConstraint.py
+72
-72
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSCacheMixin.py
...lateItem/portal_components/mixin.erp5.SlapOSCacheMixin.py
+1
-1
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
...omponents/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
+1
-1
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloud.py
...mplateItem/portal_components/test.erp5.testSlapOSCloud.py
+12
-4
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
...eItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
+8
-8
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudComputeNodeSlapInterfaceWorkflow.py
...t.erp5.testSlapOSCloudComputeNodeSlapInterfaceWorkflow.py
+21
-21
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudConstraint.py
.../portal_components/test.erp5.testSlapOSCloudConstraint.py
+64
-64
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow.py
...test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow.py
+2
-2
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudSecurityGroup.py
...rtal_components/test.erp5.testSlapOSCloudSecurityGroup.py
+8
-8
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudShadow.py
...Item/portal_components/test.erp5.testSlapOSCloudShadow.py
+3
-3
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudUpgrader.py
...em/portal_components/test.erp5.testSlapOSCloudUpgrader.py
+22
-22
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
...ortal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
+59
-15
master/bt5/slapos_jio_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalSlapOSRenderJSOSSUIHalStyle.py
...ts/test.erp5.testFunctionalSlapOSRenderJSOSSUIHalStyle.py
+3
-1
master/bt5/slapos_jio_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalSlapOSUIZHHalStyle.py
..._components/test.erp5.testFunctionalSlapOSUIZHHalStyle.py
+3
-1
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm.py
...oySoftwareInstallationWithArchivedSoftwareReleaseAlarm.py
+6
-6
master/bt5/slapos_rss_style/TestTemplateItem/portal_components/test.erp5.testSlapOSRSSStyleSkins.py
...em/portal_components/test.erp5.testSlapOSRSSStyleSkins.py
+1
-1
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.py
...ateItem/portal_components/test.erp5.testSlapOSSlapTool.py
+71
-95
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapToolComputeNodeUpdateFromDict.py
.../test.erp5.testSlapOSSlapToolComputeNodeUpdateFromDict.py
+1
-1
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionCondition_renderKVMClusterParameter.py
...equest/SubscriptionCondition_renderKVMClusterParameter.py
+6
-1
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
...al_components/test.erp5.testSlapOSSubscriptionScenario.py
+6
-6
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionSkins.py
...ortal_components/test.erp5.testSlapOSSubscriptionSkins.py
+25
-25
slapos/tests/test_promise.py
slapos/tests/test_promise.py
+9
-9
slapos/tests/test_slapgrid.py
slapos/tests/test_slapgrid.py
+2
-2
No files found.
master/bt5/slapos_abyss/TestTemplateItem/portal_components/test.erp5.testSlapOSAbyss.py
View file @
ccbf6e16
...
...
@@ -246,7 +246,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for
new_array
in
new_array_list
:
if
'file_system_image/process_state/converted'
in
new_array
.
getPublicationSectionList
():
break
self
.
assert
True
(
'file_system_image/process_state/converted'
in
new_array
.
getPublicationSectionList
())
self
.
assert
In
(
'file_system_image/process_state/converted'
,
new_array
.
getPublicationSectionList
())
self
.
assertEquals
(
len
(
new_array
.
getArray
()),
0
)
...
...
@@ -295,7 +295,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for
compute_node
in
self
.
compute_node_list
:
data_array_list
=
self
.
_getRelatedDataArrayList
(
compute_node
)
self
.
assertEqual
(
len
(
data_array_list
),
1
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
portal
.
portal_alarms
.
wendelin_handle_analysis
.
activeSense
()
self
.
tic
()
...
...
@@ -304,7 +304,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for
compute_node
in
self
.
compute_node_list
:
data_array_list
=
self
.
_getRelatedDataArrayList
(
compute_node
)
self
.
assertEqual
(
len
(
data_array_list
),
1
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
0
].
getPublicationSectionList
())
# process data array
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
...
...
@@ -315,7 +315,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for
compute_node
in
self
.
compute_node_list
:
data_array_list
=
self
.
_getRelatedDataArrayList
(
compute_node
)
self
.
assertEqual
(
len
(
data_array_list
),
2
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
-
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
-
1
].
getPublicationSectionList
())
self
.
portal
.
portal_alarms
.
wendelin_handle_analysis
.
activeSense
()
...
...
@@ -324,7 +324,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for
compute_node
in
self
.
compute_node_list
:
data_array_list
=
self
.
_getRelatedDataArrayList
(
compute_node
)
self
.
assertEqual
(
len
(
data_array_list
),
2
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
-
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
-
1
].
getPublicationSectionList
())
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
...
...
@@ -384,28 +384,28 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for
compute_node
in
self
.
compute_node_list
:
data_array_list
=
self
.
_getRelatedDataArrayList
(
compute_node
)
self
.
assertEqual
(
len
(
data_array_list
),
2
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
-
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
-
1
].
getPublicationSectionList
())
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
self
.
tic
()
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'database_debian10'
])
self
.
assertEqual
(
len
(
data_array_list
),
2
)
self
.
assert
True
(
"file_system_image/process_state/archived"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/archived"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
1
].
getPublicationSectionList
())
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'database_debian11'
])
self
.
assertEqual
(
len
(
data_array_list
),
2
)
self
.
assert
True
(
"file_system_image/process_state/archived"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/archived"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
1
].
getPublicationSectionList
())
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'node_debian10'
])
self
.
assertEqual
(
len
(
data_array_list
),
2
)
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
True
(
'file_system_image/diff_end/identical'
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
'file_system_image/diff_end/identical'
,
data_array_list
[
1
].
getPublicationSectionList
())
# now ingest different data for node_debian10
request_dict
=
{
...
...
@@ -421,24 +421,24 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
self
.
tic
()
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'node_debian10'
])
self
.
assertEqual
(
len
(
data_array_list
),
3
)
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
1
].
getPublicationSectionList
())
# This is the new one with different value
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
2
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
2
].
getPublicationSectionList
())
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
self
.
tic
()
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'node_debian10'
])
self
.
assertEqual
(
len
(
data_array_list
),
4
)
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
2
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
2
].
getPublicationSectionList
())
# array 3 is the result of array 0 and array 2, Note: array 0 is the first access data
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
3
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
3
].
getPublicationSectionList
())
predecessor_list
=
[
x
.
getRelativeUrl
()
for
x
in
data_array_list
[
3
].
getPredecessorValueList
(
portal_type
=
'Data Array'
)]
self
.
assert
True
(
data_array_list
[
0
].
getRelativeUrl
()
in
predecessor_list
)
self
.
assert
True
(
data_array_list
[
2
].
getRelativeUrl
()
in
predecessor_list
)
self
.
assert
In
(
data_array_list
[
0
].
getRelativeUrl
(),
predecessor_list
)
self
.
assert
In
(
data_array_list
[
2
].
getRelativeUrl
(),
predecessor_list
)
# only have one diff
self
.
assertTrue
(
len
(
data_array_list
[
3
].
getArray
()),
1
)
...
...
@@ -447,17 +447,17 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
# array 3 compare with database_debian10
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'node_debian10'
])
self
.
assertEqual
(
len
(
data_array_list
),
5
)
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
2
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
3
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
2
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
3
].
getPublicationSectionList
())
# array 4 is result of array 3 and database_debian10
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
4
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
4
].
getPublicationSectionList
())
predecessor_list
=
[
x
.
getRelativeUrl
()
for
x
in
data_array_list
[
4
].
getPredecessorValueList
(
portal_type
=
'Data Array'
)]
last_detabase_debian10
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'database_debian10'
])[
-
1
]
self
.
assert
True
(
last_detabase_debian10
.
getRelativeUrl
()
in
predecessor_list
)
self
.
assert
True
(
data_array_list
[
3
].
getRelativeUrl
()
in
predecessor_list
)
self
.
assert
In
(
last_detabase_debian10
.
getRelativeUrl
(),
predecessor_list
)
self
.
assert
In
(
data_array_list
[
3
].
getRelativeUrl
(),
predecessor_list
)
self
.
assertTrue
(
len
(
data_array_list
[
4
].
getArray
()),
1
)
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
...
...
@@ -465,25 +465,25 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
# array 4 compare with database_debian11
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'node_debian10'
])
self
.
assertEqual
(
len
(
data_array_list
),
6
)
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
2
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
3
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
4
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
2
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
3
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
4
].
getPublicationSectionList
())
# array 5 is result of array 4 and database_debian11
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
5
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
5
].
getPublicationSectionList
())
predecessor_list
=
[
x
.
getRelativeUrl
()
for
x
in
data_array_list
[
5
].
getPredecessorValueList
(
portal_type
=
'Data Array'
)]
last_detabase_debian11
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'database_debian11'
])[
-
1
]
self
.
assert
True
(
last_detabase_debian11
.
getRelativeUrl
()
in
predecessor_list
)
self
.
assert
True
(
data_array_list
[
4
].
getRelativeUrl
()
in
predecessor_list
)
self
.
assert
In
(
last_detabase_debian11
.
getRelativeUrl
(),
predecessor_list
)
self
.
assert
In
(
data_array_list
[
4
].
getRelativeUrl
(),
predecessor_list
)
self
.
assertTrue
(
len
(
data_array_list
[
5
].
getArray
()),
1
)
# no more database to compare
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
self
.
tic
()
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
5
].
getPublicationSectionList
())
self
.
assert
True
(
'file_system_image/diff_end/different'
in
data_array_list
[
5
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
5
].
getPublicationSectionList
())
self
.
assert
In
(
'file_system_image/diff_end/different'
,
data_array_list
[
5
].
getPublicationSectionList
())
def
test_data_processing_for_multi_data_ingestion
(
self
):
# almost same as test_data_processing_for_sequence_data_ingestion
...
...
@@ -516,7 +516,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for
compute_node
in
self
.
compute_node_list
:
data_array_list
=
self
.
_getRelatedDataArrayList
(
compute_node
)
self
.
assertEqual
(
len
(
data_array_list
),
1
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
0
].
getPublicationSectionList
())
# process data array
...
...
@@ -524,17 +524,17 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
self
.
tic
()
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'database_debian10'
])
self
.
assertEqual
(
len
(
data_array_list
),
1
)
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
0
].
getPublicationSectionList
())
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'database_debian11'
])
self
.
assertEqual
(
len
(
data_array_list
),
1
)
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
0
].
getPublicationSectionList
())
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'node_debian10'
])
self
.
assertEqual
(
len
(
data_array_list
),
1
)
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
portal
.
portal_alarms
.
wendelin_handle_analysis
.
activeSense
()
...
...
@@ -543,49 +543,49 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for
compute_node
in
self
.
compute_node_list
:
data_array_list
=
self
.
_getRelatedDataArrayList
(
compute_node
)
self
.
assertEqual
(
len
(
data_array_list
),
2
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
-
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
-
1
].
getPublicationSectionList
())
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
self
.
tic
()
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'database_debian10'
])
self
.
assertEqual
(
len
(
data_array_list
),
2
)
self
.
assert
True
(
"file_system_image/process_state/archived"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/archived"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
1
].
getPublicationSectionList
())
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'database_debian11'
])
self
.
assertEqual
(
len
(
data_array_list
),
2
)
self
.
assert
True
(
"file_system_image/process_state/archived"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/archived"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
1
].
getPublicationSectionList
())
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'node_debian10'
])
self
.
assertEqual
(
len
(
data_array_list
),
2
)
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
True
(
'file_system_image/diff_end/identical'
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
'file_system_image/diff_end/identical'
,
data_array_list
[
1
].
getPublicationSectionList
())
self
.
portal
.
ERP5Site_createDataAnalysisList
()
self
.
portal
.
ERP5Site_executeDataAnalysisList
()
self
.
tic
()
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'node_debian10'
])
self
.
assertEqual
(
len
(
data_array_list
),
3
)
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
1
].
getPublicationSectionList
())
# This is the new one with different value
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
2
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
2
].
getPublicationSectionList
())
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
self
.
tic
()
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'node_debian10'
])
self
.
assertEqual
(
len
(
data_array_list
),
4
)
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
2
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
2
].
getPublicationSectionList
())
# array 3 is the result of array 0 and array 2, Note: array 0 is the first access data
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
3
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
3
].
getPublicationSectionList
())
predecessor_list
=
[
x
.
getRelativeUrl
()
for
x
in
data_array_list
[
3
].
getPredecessorValueList
(
portal_type
=
'Data Array'
)]
self
.
assert
True
(
data_array_list
[
0
].
getRelativeUrl
()
in
predecessor_list
)
self
.
assert
True
(
data_array_list
[
2
].
getRelativeUrl
()
in
predecessor_list
)
self
.
assert
In
(
data_array_list
[
0
].
getRelativeUrl
(),
predecessor_list
)
self
.
assert
In
(
data_array_list
[
2
].
getRelativeUrl
(),
predecessor_list
)
# only have one diff
self
.
assertTrue
(
len
(
data_array_list
[
3
].
getArray
()),
1
)
...
...
@@ -594,16 +594,16 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
# array 3 compare with database_debian10
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'node_debian10'
])
self
.
assertEqual
(
len
(
data_array_list
),
5
)
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
2
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
3
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
2
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
3
].
getPublicationSectionList
())
# array 4 is result of array 3 and database_debian10
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
4
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
4
].
getPublicationSectionList
())
predecessor_list
=
[
x
.
getRelativeUrl
()
for
x
in
data_array_list
[
4
].
getPredecessorValueList
(
portal_type
=
'Data Array'
)]
last_detabase_debian10
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'database_debian10'
])[
-
1
]
self
.
assert
True
(
last_detabase_debian10
.
getRelativeUrl
()
in
predecessor_list
)
self
.
assert
True
(
data_array_list
[
3
].
getRelativeUrl
()
in
predecessor_list
)
self
.
assert
In
(
last_detabase_debian10
.
getRelativeUrl
(),
predecessor_list
)
self
.
assert
In
(
data_array_list
[
3
].
getRelativeUrl
(),
predecessor_list
)
self
.
assertTrue
(
len
(
data_array_list
[
4
].
getArray
()),
1
)
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
...
...
@@ -611,25 +611,25 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
# array 4 compare with database_debian11
data_array_list
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'node_debian10'
])
self
.
assertEqual
(
len
(
data_array_list
),
6
)
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
2
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
3
].
getPublicationSectionList
())
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
4
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
0
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
1
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
2
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
3
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
4
].
getPublicationSectionList
())
# array 5 is result of array 4 and database_debian11
self
.
assert
True
(
"file_system_image/process_state/converted"
in
data_array_list
[
5
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
data_array_list
[
5
].
getPublicationSectionList
())
predecessor_list
=
[
x
.
getRelativeUrl
()
for
x
in
data_array_list
[
5
].
getPredecessorValueList
(
portal_type
=
'Data Array'
)]
last_detabase_debian11
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'database_debian11'
])[
-
1
]
self
.
assert
True
(
last_detabase_debian11
.
getRelativeUrl
()
in
predecessor_list
)
self
.
assert
True
(
data_array_list
[
4
].
getRelativeUrl
()
in
predecessor_list
)
self
.
assert
In
(
last_detabase_debian11
.
getRelativeUrl
(),
predecessor_list
)
self
.
assert
In
(
data_array_list
[
4
].
getRelativeUrl
(),
predecessor_list
)
self
.
assertTrue
(
len
(
data_array_list
[
5
].
getArray
()),
1
)
# no more database to compare
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
self
.
tic
()
self
.
assert
True
(
"file_system_image/process_state/processed"
in
data_array_list
[
5
].
getPublicationSectionList
())
self
.
assert
True
(
'file_system_image/diff_end/different'
in
data_array_list
[
5
].
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
data_array_list
[
5
].
getPublicationSectionList
())
self
.
assert
In
(
'file_system_image/diff_end/different'
,
data_array_list
[
5
].
getPublicationSectionList
())
def
test_data_processing_check_copmute_node_state
(
self
):
...
...
@@ -666,8 +666,8 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
self
.
tic
()
last_diff_array
=
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'node_debian10'
])[
-
1
]
self
.
assert
True
(
modified_array
.
getReference
()
in
last_diff_array
.
getReference
())
self
.
assert
True
(
default_array
.
getReference
()
in
last_diff_array
.
getReference
())
self
.
assert
In
(
modified_array
.
getReference
(),
last_diff_array
.
getReference
())
self
.
assert
In
(
default_array
.
getReference
(),
last_diff_array
.
getReference
())
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
self
.
tic
()
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
...
...
@@ -696,7 +696,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
self
.
tic
()
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
self
.
tic
()
self
.
assert
True
(
'file_system_image/diff_end/identical'
in
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'node_debian10'
])[
-
1
].
getPublicationSectionList
())
self
.
assert
In
(
'file_system_image/diff_end/identical'
,
self
.
_getRelatedDataArrayList
(
self
.
portal
.
compute_node_module
[
'node_debian10'
])[
-
1
].
getPublicationSectionList
())
self
.
assertTrue
(
self
.
portal
.
compute_node_module
[
'node_debian10'
].
ComputeNode_hasModifiedFile
()
is
None
)
...
...
@@ -782,42 +782,42 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
diff_server_data_array_list
=
[]
for
i
in
server_data_array_list
:
self
.
assert
True
(
"file_system_image/process_state/processed"
in
i
.
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/processed"
,
i
.
getPublicationSectionList
())
diff_server_data_array_list
.
append
(
i
.
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
))
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
self
.
tic
()
self
.
assert
True
(
diff_server_data_array_list
[
0
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
in
reference_data_array_list
[
0
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
self
.
assert
In
(
diff_server_data_array_list
[
0
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
),
reference_data_array_list
[
0
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
diff_1
=
diff_server_data_array_list
[
0
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
self
.
assertEqual
(
len
(
diff_1
.
getPredecessorValueList
(
portal_type
=
'Data Array'
)),
2
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
diff_1
.
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
diff_1
.
getPublicationSectionList
())
self
.
assertTrue
((
diff_1
.
getArray
()
==
[
7
,
9
,
10
,
11
,
15
,
17
,
18
]).
all
())
self
.
assert
True
(
diff_server_data_array_list
[
1
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
in
reference_data_array_list
[
0
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
self
.
assert
In
(
diff_server_data_array_list
[
1
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
),
reference_data_array_list
[
0
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
diff_2
=
diff_server_data_array_list
[
1
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
self
.
assertEqual
(
len
(
diff_2
.
getPredecessorValueList
(
portal_type
=
'Data Array'
)),
2
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
diff_2
.
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
diff_2
.
getPublicationSectionList
())
self
.
assertTrue
((
diff_2
.
getArray
()
==
[
2
,
8
,
14
]).
all
())
self
.
assert
True
(
diff_server_data_array_list
[
2
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
in
reference_data_array_list
[
0
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
self
.
assert
In
(
diff_server_data_array_list
[
2
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
),
reference_data_array_list
[
0
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
diff_3
=
diff_server_data_array_list
[
2
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
self
.
assertEqual
(
len
(
diff_3
.
getPredecessorValueList
(
portal_type
=
'Data Array'
)),
2
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
diff_3
.
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
diff_3
.
getPublicationSectionList
())
self
.
assertTrue
((
diff_3
.
getArray
()
==
[
11
,
17
,
31
]).
all
())
self
.
assert
True
(
diff_server_data_array_list
[
3
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
in
reference_data_array_list
[
1
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
self
.
assert
In
(
diff_server_data_array_list
[
3
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
),
reference_data_array_list
[
1
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
diff_4
=
diff_server_data_array_list
[
3
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
self
.
assertEqual
(
len
(
diff_4
.
getPredecessorValueList
(
portal_type
=
'Data Array'
)),
2
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
diff_4
.
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
diff_4
.
getPublicationSectionList
())
self
.
assertTrue
((
diff_4
.
getArray
()
==
[
2
,
24
]).
all
())
self
.
assert
True
(
diff_server_data_array_list
[
4
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
in
reference_data_array_list
[
1
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
self
.
assert
In
(
diff_server_data_array_list
[
4
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
),
reference_data_array_list
[
1
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
diff_5
=
diff_server_data_array_list
[
4
].
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
self
.
assertEqual
(
len
(
diff_5
.
getPredecessorValueList
(
portal_type
=
'Data Array'
)),
2
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
diff_5
.
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
diff_5
.
getPublicationSectionList
())
self
.
assertTrue
((
diff_5
.
getArray
()
==
[
17
,
28
,
31
]).
all
(),
diff_5
.
getRelativeUrl
())
...
...
@@ -826,30 +826,30 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
self
.
assert
True
(
'file_system_image/diff_end/different'
in
diff_4
.
getPublicationSectionList
())
self
.
assert
True
(
'file_system_image/diff_end/different'
in
diff_5
.
getPublicationSectionList
())
self
.
assert
In
(
'file_system_image/diff_end/different'
,
diff_4
.
getPublicationSectionList
())
self
.
assert
In
(
'file_system_image/diff_end/different'
,
diff_5
.
getPublicationSectionList
())
self
.
assert
True
(
diff_1
.
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
in
reference_data_array_list
[
1
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
self
.
assert
In
(
diff_1
.
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
),
reference_data_array_list
[
1
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
diff_6
=
diff_1
.
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
self
.
assertEqual
(
len
(
diff_6
.
getPredecessorValueList
(
portal_type
=
'Data Array'
)),
2
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
diff_6
.
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
diff_6
.
getPublicationSectionList
())
self
.
assertTrue
((
diff_6
.
getArray
()
==
[
15
,
17
,
18
]).
all
(),
diff_6
.
getRelativeUrl
())
self
.
assert
True
(
diff_2
.
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
in
reference_data_array_list
[
1
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
self
.
assert
In
(
diff_2
.
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
),
reference_data_array_list
[
1
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
diff_7
=
diff_2
.
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
self
.
assertEqual
(
len
(
diff_7
.
getPredecessorValueList
(
portal_type
=
'Data Array'
)),
2
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
diff_7
.
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
diff_7
.
getPublicationSectionList
())
self
.
assertTrue
((
diff_7
.
getArray
()
==
[
2
]).
all
(),
diff_7
.
getRelativeUrl
())
self
.
assert
True
(
diff_3
.
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
in
reference_data_array_list
[
1
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
self
.
assert
In
(
diff_3
.
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
),
reference_data_array_list
[
1
].
getPredecessorRelatedValueList
(
portal_type
=
'Data Array'
))
diff_8
=
diff_3
.
getPredecessorRelatedValue
(
portal_type
=
'Data Array'
)
self
.
assertEqual
(
len
(
diff_8
.
getPredecessorValueList
(
portal_type
=
'Data Array'
)),
2
)
self
.
assert
True
(
"file_system_image/process_state/converted"
in
diff_8
.
getPublicationSectionList
())
self
.
assert
In
(
"file_system_image/process_state/converted"
,
diff_8
.
getPublicationSectionList
())
self
.
assertTrue
((
diff_8
.
getArray
()
==
[
17
,
31
]).
all
(),
diff_8
.
getRelativeUrl
())
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
self
.
tic
()
for
i
in
[
diff_6
,
diff_7
,
diff_8
]:
self
.
assert
True
(
'file_system_image/diff_end/different'
in
i
.
getPublicationSectionList
())
self
.
assert
In
(
'file_system_image/diff_end/different'
,
i
.
getPublicationSectionList
())
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingBuilder.py
View file @
ccbf6e16
...
...
@@ -1403,7 +1403,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
self
.
assertFalse
(
transaction_line
.
hasStopDate
())
self
.
assertEqual
([],
transaction_line
.
contentValues
(
portal_type
=
'Delivery Cell'
))
self
.
assert
True
(
simulation_movement
.
getRelativeUrl
()
in
self
.
assert
In
(
simulation_movement
.
getRelativeUrl
(),
transaction_line
.
getDeliveryRelatedList
(
portal_type
=
'Simulation Movement'
))
...
...
@@ -1741,7 +1741,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
self
.
assertFalse
(
transaction_line
.
hasStopDate
())
self
.
assertEqual
([],
transaction_line
.
contentValues
(
portal_type
=
'Delivery Cell'
))
self
.
assert
True
(
simulation_movement
.
getRelativeUrl
()
in
self
.
assert
In
(
simulation_movement
.
getRelativeUrl
(),
transaction_line
.
getDeliveryRelatedList
(
portal_type
=
'Simulation Movement'
))
...
...
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingConstraint.py
View file @
ccbf6e16
...
...
@@ -30,10 +30,10 @@ class TestInstanceTree(TestSlapOSConstraintMixin):
def
test_periodicity_hour_list_value
(
self
):
value
=
7
message
=
'Attribute periodicity_hour_list value is [7] but should be [0]'
self
.
assert
False
(
message
in
self
.
getMessageList
(
self
.
subscription
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
self
.
subscription
))
self
.
subscription
.
setPeriodicityHour
(
value
)
self
.
assert
True
(
message
in
self
.
getMessageList
(
self
.
subscription
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
self
.
subscription
))
self
.
subscription
.
setPeriodicityHour
(
0
)
...
...
@@ -44,10 +44,10 @@ class TestInstanceTree(TestSlapOSConstraintMixin):
def
test_periodicity_minute_list_value
(
self
):
value
=
7
message
=
'Attribute periodicity_minute_list value is [7] but should be [0]'
self
.
assert
False
(
message
in
self
.
getMessageList
(
self
.
subscription
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
self
.
subscription
))
self
.
subscription
.
setPeriodicityMinute
(
value
)
self
.
assert
True
(
message
in
self
.
getMessageList
(
self
.
subscription
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
self
.
subscription
))
self
.
subscription
.
setPeriodicityMinute
(
0
)
...
...
@@ -57,36 +57,36 @@ class TestInstanceTree(TestSlapOSConstraintMixin):
def
test_periodicity_month_day_list_lenght
(
self
):
message
=
'There was too many objects in periodicity_month_day_list'
self
.
assert
False
(
message
in
self
.
getMessageList
(
self
.
subscription
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
self
.
subscription
))
self
.
subscription
.
setPeriodicityMonthDayList
([
1
,
2
])
self
.
assert
True
(
message
in
self
.
getMessageList
(
self
.
subscription
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
self
.
subscription
))
self
.
subscription
.
setPeriodicityMonthDayList
([
1
])
self
.
assert
False
(
message
in
self
.
getMessageList
(
self
.
subscription
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
self
.
subscription
))
def
test_periodicity_month_day_value_range
(
self
):
message
=
'The periodicity_month_day value is not between 1 and 28 '
\
'inclusive'
self
.
assert
False
(
message
in
self
.
getMessageList
(
self
.
subscription
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
self
.
subscription
))
self
.
subscription
.
setPeriodicityMonthDay
(
0
)
self
.
assert
True
(
message
in
self
.
getMessageList
(
self
.
subscription
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
self
.
subscription
))
self
.
subscription
.
setPeriodicityMonthDay
(
29
)
self
.
assert
True
(
message
in
self
.
getMessageList
(
self
.
subscription
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
self
.
subscription
))
self
.
subscription
.
setPeriodicityMonthDay
(
28
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
self
.
subscription
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
self
.
subscription
))
self
.
subscription
.
setPeriodicityMonthDay
(
1
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
self
.
subscription
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
self
.
subscription
))
self
.
subscription
.
setPeriodicityMonthDay
(
15
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
self
.
subscription
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
self
.
subscription
))
self
.
subscription
.
setPeriodicityMonthDay
(
None
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
self
.
subscription
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
self
.
subscription
))
def
test_periodicity_property
(
self
):
template
=
'Property existence error for property %s, this '
\
...
...
@@ -101,16 +101,16 @@ class TestInstanceTree(TestSlapOSConstraintMixin):
class
TestSaleInvoiceTransaction
(
TestSlapOSConstraintMixin
):
@
withAbort
def
_test_currency
(
self
,
invoice
,
setter
,
message
):
self
.
assert
True
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
invoice
))
currency
=
self
.
portal
.
currency_module
.
newContent
(
portal_type
=
'Currency'
)
setter
(
currency
.
getRelativeUrl
())
self
.
assert
False
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
invoice
))
resource
=
self
.
portal
.
service_module
.
newContent
(
portal_type
=
'Service'
)
setter
(
resource
.
getRelativeUrl
())
self
.
assert
True
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
invoice
))
def
test_price_currency
(
self
):
invoice
=
self
.
portal
.
accounting_module
.
newContent
(
...
...
@@ -133,34 +133,34 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
setter
=
invoice
.
setSpecialise
message
=
"Arity Error for Relation ['specialise'] and Type "
\
"('Sale Trade Condition',), arity is equal to 0 but should be at least 1"
self
.
assert
True
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
invoice
))
sale_condition
=
self
.
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
'Sale Trade Condition'
)
setter
(
sale_condition
.
getRelativeUrl
())
self
.
assert
False
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
invoice
))
purchase_condition
=
self
.
portal
.
purchase_trade_condition_module
.
newContent
(
portal_type
=
'Purchase Trade Condition'
)
setter
(
purchase_condition
.
getRelativeUrl
())
self
.
assert
True
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
invoice
))
@
withAbort
def
test_specialise_value
(
self
):
invoice
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction'
)
message
=
"Only SlapOS trade condition is allowed"
self
.
assert
True
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
invoice
))
sale_condition
=
self
.
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
'Sale Trade Condition'
)
invoice
.
setSpecialise
(
sale_condition
.
getRelativeUrl
())
self
.
assert
True
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
invoice
))
invoice
.
setSpecialise
(
'sale_trade_condition_module/slapos_aggregated_trade_condition'
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
invoice
))
@
withAbort
def
test_total_price_equal_accounting
(
self
):
...
...
@@ -170,13 +170,13 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
price_currency
=
'currency_module/EUR'
)
invoice
.
newContent
(
portal_type
=
'Invoice Line'
,
quantity
=
1.
,
price
=
1.
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
invoice
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice
,
'confirmed'
)
self
.
assert
True
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
invoice
))
invoice
.
receivable
.
setQuantity
(
-
1.0
)
invoice
.
income
.
setQuantity
(
1.0
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
invoice
))
@
withAbort
def
test_trade_model_match_lines
(
self
):
...
...
@@ -188,14 +188,14 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
invoice
.
newContent
(
portal_type
=
'Invoice Line'
,
quantity
=
1.
,
price
=
1.
,
base_contribution
=
'base_amount/invoicing/taxable'
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
invoice
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice
,
'confirmed'
)
self
.
assert
True
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
invoice
))
invoice
.
newContent
(
portal_type
=
'Invoice Line'
,
quantity
=
1.
,
price
=
.
196
,
use
=
'trade/tax'
,
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
invoice
))
@
withAbort
def
test_use_trade_sale_total_price_matches_delivery_constraint
(
self
):
...
...
@@ -210,16 +210,16 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
invoice_line
=
invoice
.
newContent
(
portal_type
=
'Invoice Line'
,
quantity
=
2.
,
price
=
1.
,
use
=
'trade/sale'
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
invoice
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice
,
'confirmed'
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
invoice
))
invoice
.
setSpecialise
(
'sale_trade_condition_module/slapos_aggregated_trade_condition'
)
self
.
assert
True
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
invoice
))
invoice_line
.
setQuantity
(
1.
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
invoice
))
invoice
.
newContent
(
portal_type
=
'Invoice Line'
,
quantity
=
2.
,
price
=
1.
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
invoice
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
invoice
))
class
TestSalePackingList
(
TestSlapOSConstraintMixin
):
@
withAbort
...
...
@@ -228,9 +228,9 @@ class TestSalePackingList(TestSlapOSConstraintMixin):
delivery
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
portal_type
=
'Sale Packing List'
)
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery
))
delivery
.
newContent
(
portal_type
=
'Sale Packing List Line'
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
delivery
))
@
withAbort
def
test_reference_not_empty
(
self
):
...
...
@@ -238,29 +238,29 @@ class TestSalePackingList(TestSlapOSConstraintMixin):
delivery
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
portal_type
=
'Sale Packing List'
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
delivery
))
delivery
.
setReference
(
None
)
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery
))
@
withAbort
def
test_price_currency
(
self
):
message
=
'Exactly one Currency shall be selected'
delivery
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
portal_type
=
'Sale Packing List'
)
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery
))
resource
=
self
.
portal
.
service_module
.
newContent
(
portal_type
=
'Service'
)
delivery
.
setPriceCurrency
(
resource
.
getRelativeUrl
())
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery
))
currency_1
=
self
.
portal
.
currency_module
.
newContent
(
portal_type
=
'Currency'
)
currency_2
=
self
.
portal
.
currency_module
.
newContent
(
portal_type
=
'Currency'
)
delivery
.
setPriceCurrencyList
([
currency_1
.
getRelativeUrl
(),
currency_2
.
getRelativeUrl
()])
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery
))
delivery
.
setPriceCurrency
(
currency_1
.
getRelativeUrl
())
self
.
assert
False
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
delivery
))
@
withAbort
def
_test_category_arrow
(
self
,
category
):
...
...
@@ -278,17 +278,17 @@ class TestSalePackingList(TestSlapOSConstraintMixin):
portal_type
=
'Organisation'
).
getRelativeUrl
()
key
=
'%s_list'
%
category
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery
))
delivery
.
edit
(
**
{
key
:
[
resource
]})
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery
))
delivery
.
edit
(
**
{
key
:
[
person
,
organisation
]})
self
.
assert
True
(
message_2
in
self
.
getMessageList
(
delivery
))
self
.
assert
In
(
message_2
,
self
.
getMessageList
(
delivery
))
delivery
.
edit
(
**
{
key
:
[
person
]})
self
.
assert
False
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
False
(
message_2
in
self
.
getMessageList
(
delivery
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
delivery
))
self
.
assert
NotIn
(
message_2
,
self
.
getMessageList
(
delivery
))
delivery
.
edit
(
**
{
key
:
[
organisation
]})
self
.
assert
False
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
False
(
message_2
in
self
.
getMessageList
(
delivery
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
delivery
))
self
.
assert
NotIn
(
message_2
,
self
.
getMessageList
(
delivery
))
def
test_destination
(
self
):
self
.
_test_category_arrow
(
'destination'
)
...
...
@@ -322,23 +322,23 @@ class TestSalePackingList(TestSlapOSConstraintMixin):
portal_type
=
'Sale Trade Condition'
).
getRelativeUrl
()
key
=
'%s_list'
%
category
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery
))
delivery
.
edit
(
**
{
key
:
[
resource
]})
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery
))
delivery
.
edit
(
**
{
key
:
[
stc_1
,
stc_2
]})
self
.
assert
True
(
message_2
in
self
.
getMessageList
(
delivery
))
self
.
assert
In
(
message_2
,
self
.
getMessageList
(
delivery
))
delivery
.
edit
(
**
{
key
:
[
stc_1
]})
self
.
assert
False
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
False
(
message_2
in
self
.
getMessageList
(
delivery
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
delivery
))
self
.
assert
NotIn
(
message_2
,
self
.
getMessageList
(
delivery
))
@
withAbort
def
test_start_date
(
self
):
message
=
'Property start_date must be defined'
delivery
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
portal_type
=
'Sale Packing List'
)
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery
))
delivery
.
setStartDate
(
'2012/01/01'
)
self
.
assert
False
(
message
in
self
.
getMessageList
(
delivery
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
delivery
))
class
TestSalePackingListLine
(
TestSlapOSConstraintMixin
):
@
withAbort
...
...
@@ -350,14 +350,14 @@ class TestSalePackingListLine(TestSlapOSConstraintMixin):
delivery_line
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
portal_type
=
'Sale Packing List'
).
newContent
(
portal_type
=
'Sale Packing List Line'
)
self
.
assert
True
(
message_price
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
True
(
message_quantity
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
In
(
message_price
,
self
.
getMessageList
(
delivery_line
))
self
.
assert
In
(
message_quantity
,
self
.
getMessageList
(
delivery_line
))
delivery_line
.
setQuantity
(
1.0
)
self
.
assert
True
(
message_price
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
False
(
message_quantity
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
In
(
message_price
,
self
.
getMessageList
(
delivery_line
))
self
.
assert
NotIn
(
message_quantity
,
self
.
getMessageList
(
delivery_line
))
delivery_line
.
setPrice
(
1.0
)
self
.
assert
False
(
message_price
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
False
(
message_quantity
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
NotIn
(
message_price
,
self
.
getMessageList
(
delivery_line
))
self
.
assert
NotIn
(
message_quantity
,
self
.
getMessageList
(
delivery_line
))
@
withAbort
def
test_resource_arity
(
self
):
...
...
@@ -377,14 +377,14 @@ class TestSalePackingListLine(TestSlapOSConstraintMixin):
portal_type
=
'Service'
).
getRelativeUrl
()
key
=
'%s_list'
%
category
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery_line
))
delivery_line
.
edit
(
**
{
key
:
[
product
]})
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery_line
))
delivery_line
.
edit
(
**
{
key
:
[
service_1
,
service_2
]})
self
.
assert
True
(
message_2
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
In
(
message_2
,
self
.
getMessageList
(
delivery_line
))
delivery_line
.
edit
(
**
{
key
:
[
service_1
]})
self
.
assert
False
(
message
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
False
(
message_2
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
delivery_line
))
self
.
assert
NotIn
(
message_2
,
self
.
getMessageList
(
delivery_line
))
class
TestSalePackingListLineConsumption
(
TestSlapOSConstraintMixin
):
@
withAbort
...
...
@@ -397,15 +397,15 @@ class TestSalePackingListLineConsumption(TestSlapOSConstraintMixin):
portal_type
=
'Product'
).
getRelativeUrl
()
key
=
'%s_list'
%
category
self
.
assert
False
(
message
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
delivery_line
))
delivery
.
edit
(
specialise
=
'sale_trade_condition_module/slapos_consumption_trade_condition'
)
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery_line
))
delivery_line
.
edit
(
**
{
key
:
[
product
]})
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery_line
))
delivery_line
.
edit
(
**
{
key
:
[
aggregate_1
,
aggregate_2
]})
self
.
assert
True
(
message
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
In
(
message
,
self
.
getMessageList
(
delivery_line
))
delivery_line
.
edit
(
**
{
key
:
[
aggregate_1
]})
self
.
assert
False
(
message
in
self
.
getMessageList
(
delivery_line
))
self
.
assert
NotIn
(
message
,
self
.
getMessageList
(
delivery_line
))
def
test_aggregate_instance_tree
(
self
):
self
.
_test_aggregate
(
"There should be one Instance Tree related"
,
...
...
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSCacheMixin.py
View file @
ccbf6e16
...
...
@@ -138,7 +138,7 @@ class SlapOSCacheMixin:
'state'
:
state
,
'reference'
:
self
.
getReference
(),
'portal_type'
:
self
.
getPortalType
()
})
}
,
sort_keys
=
True
)
cache_duration
=
self
.
_getAccessStatusCacheFactory
().
cache_duration
self
.
_getAccessStatusPlugin
().
set
(
self
.
_getAccessStatusCacheKey
(),
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
View file @
ccbf6e16
...
...
@@ -125,7 +125,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
def
requestComputeNode
(
self
,
title
):
requestXml
=
self
.
portal
.
portal_slap
.
requestComputer
(
title
)
self
.
tic
()
self
.
assert
True
(
'marshal'
in
requestXml
)
self
.
assert
In
(
'marshal'
,
requestXml
)
compute_node
=
xml_marshaller
.
xml_marshaller
.
loads
(
requestXml
)
compute_node_id
=
getattr
(
compute_node
,
'_computer_id'
,
None
)
self
.
assertNotEqual
(
None
,
compute_node_id
)
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloud.py
View file @
ccbf6e16
...
...
@@ -115,7 +115,9 @@ class TestSlapOSCloudSlapOSCacheMixin(
'since'
:
'%s'
%
since
,
'state'
:
""
,
"text"
:
"#access TEST123 %s"
%
doc
.
getUid
()
})
},
sort_keys
=
True
,
)
def
getBaseExpectedDict
(
doc
):
return
_decode_with_json
({
"portal_type"
:
doc
.
getPortalType
(),
...
...
@@ -187,7 +189,9 @@ class TestSlapOSCloudSlapOSCacheMixin(
'since'
:
'%s'
%
since
,
'state'
:
""
,
"text"
:
"#access TEST123 %s"
%
doc
.
getUid
()
})
},
sort_keys
=
True
,
)
def
getBaseExpectedDict
(
doc
):
return
_decode_with_json
({
"portal_type"
:
doc
.
getPortalType
(),
...
...
@@ -267,7 +271,9 @@ class TestSlapOSCloudSlapOSCacheMixin(
'since'
:
'%s'
%
since
,
'state'
:
""
,
"text"
:
"#error TEST123 %s"
%
doc
.
getUid
()
})
},
sort_keys
=
True
,
)
def
getBaseExpectedDict
(
doc
):
return
_decode_with_json
({
"portal_type"
:
doc
.
getPortalType
(),
...
...
@@ -338,7 +344,9 @@ class TestSlapOSCloudSlapOSCacheMixin(
'since'
:
'%s'
%
since
,
'state'
:
""
,
"text"
:
"#building TEST123 %s"
%
doc
.
getUid
()
})
},
sort_keys
=
True
,
)
def
getBaseExpectedDict
(
doc
):
return
_decode_with_json
({
"portal_type"
:
doc
.
getPortalType
(),
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
View file @
ccbf6e16
...
...
@@ -17,11 +17,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(
self
.
tic
()
# check that no interaction has recreated the instance
self
.
assert
False
(
self
.
instance_tree
.
getTitle
()
in
self
.
assert
NotIn
(
self
.
instance_tree
.
getTitle
(),
self
.
instance_tree
.
getSuccessorTitleList
())
self
.
instance_tree
.
InstanceTree_assertSuccessor
()
self
.
assert
True
(
self
.
instance_tree
.
getTitle
()
in
self
.
assert
In
(
self
.
instance_tree
.
getTitle
(),
self
.
instance_tree
.
getSuccessorTitleList
())
def
test_InstanceTree_assertSuccessor_stop_requested
(
self
):
...
...
@@ -31,11 +31,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(
self
.
tic
()
# check that no interaction has recreated the instance
self
.
assert
False
(
self
.
instance_tree
.
getTitle
()
in
self
.
assert
NotIn
(
self
.
instance_tree
.
getTitle
(),
self
.
instance_tree
.
getSuccessorTitleList
())
self
.
instance_tree
.
InstanceTree_assertSuccessor
()
self
.
assert
True
(
self
.
instance_tree
.
getTitle
()
in
self
.
assert
In
(
self
.
instance_tree
.
getTitle
(),
self
.
instance_tree
.
getSuccessorTitleList
())
def
test_InstanceTree_assertSuccessor_destroy_requested
(
self
):
...
...
@@ -45,11 +45,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(
self
.
tic
()
# check that no interaction has recreated the instance
self
.
assert
False
(
self
.
instance_tree
.
getTitle
()
in
self
.
assert
NotIn
(
self
.
instance_tree
.
getTitle
(),
self
.
instance_tree
.
getSuccessorTitleList
())
self
.
instance_tree
.
InstanceTree_assertSuccessor
()
self
.
assert
False
(
self
.
instance_tree
.
getTitle
()
in
self
.
assert
NotIn
(
self
.
instance_tree
.
getTitle
(),
self
.
instance_tree
.
getSuccessorTitleList
())
def
test_InstanceTree_assertSuccessor_archived
(
self
):
...
...
@@ -58,11 +58,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(
self
.
tic
()
# check that no interaction has recreated the instance
self
.
assert
False
(
self
.
instance_tree
.
getTitle
()
in
self
.
assert
NotIn
(
self
.
instance_tree
.
getTitle
(),
self
.
instance_tree
.
getSuccessorTitleList
())
self
.
instance_tree
.
InstanceTree_assertSuccessor
()
self
.
assert
False
(
self
.
instance_tree
.
getTitle
()
in
self
.
assert
NotIn
(
self
.
instance_tree
.
getTitle
(),
self
.
instance_tree
.
getSuccessorTitleList
())
def
test_alarm_renamed
(
self
):
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudComputeNodeSlapInterfaceWorkflow.py
View file @
ccbf6e16
...
...
@@ -59,8 +59,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
getDestinationReference
(),
None
)
serial
=
'0x%x'
%
int
(
certificate_login
.
getDestinationReference
(),
16
)
self
.
assert
True
(
serial
in
compute_node_certificate
)
self
.
assert
True
(
certificate_login
.
getReference
()
in
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
In
(
serial
,
compute_node_certificate
)
self
.
assert
In
(
certificate_login
.
getReference
(),
compute_node_certificate
.
decode
(
'string_escape'
))
def
test_generateCertificate_twice
(
self
):
self
.
login
(
self
.
compute_node
.
getUserId
())
...
...
@@ -78,8 +78,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
getDestinationReference
(),
None
)
serial
=
'0x%x'
%
int
(
certificate_login
.
getDestinationReference
(),
16
)
self
.
assert
True
(
serial
in
compute_node_certificate
)
self
.
assert
True
(
certificate_login
.
getReference
()
in
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
In
(
serial
,
compute_node_certificate
)
self
.
assert
In
(
certificate_login
.
getReference
(),
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assertRaises
(
ValueError
,
self
.
compute_node
.
generateCertificate
)
self
.
assertEqual
(
None
,
self
.
portal
.
REQUEST
.
get
(
'compute_node_key'
))
...
...
@@ -271,8 +271,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
getDestinationReference
(),
None
)
serial
=
'0x%x'
%
int
(
certificate_login
.
getDestinationReference
(),
16
)
self
.
assert
True
(
serial
in
compute_node_certificate
)
self
.
assert
True
(
certificate_login
.
getReference
()
in
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
In
(
serial
,
compute_node_certificate
)
self
.
assert
In
(
certificate_login
.
getReference
(),
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
self
.
compute_node
.
getReference
())
...
...
@@ -305,8 +305,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
getDestinationReference
(),
None
)
serial
=
'0x%x'
%
int
(
certificate_login
.
getDestinationReference
(),
16
)
self
.
assert
True
(
serial
in
compute_node_certificate
)
self
.
assert
True
(
certificate_login
.
getReference
()
in
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
In
(
serial
,
compute_node_certificate
)
self
.
assert
In
(
certificate_login
.
getReference
(),
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
self
.
compute_node
.
getReference
())
...
...
@@ -340,8 +340,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
getDestinationReference
(),
None
)
serial
=
'0x%x'
%
int
(
certificate_login
.
getDestinationReference
(),
16
)
self
.
assert
True
(
serial
in
compute_node_certificate
)
self
.
assert
True
(
certificate_login
.
getReference
()
in
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
In
(
serial
,
compute_node_certificate
)
self
.
assert
In
(
certificate_login
.
getReference
(),
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
self
.
compute_node
.
getReference
())
self
.
assertNotEqual
(
None
,
destination_reference
)
...
...
@@ -375,9 +375,9 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
serial
=
'0x%x'
%
int
(
new_certificate_login
.
getDestinationReference
(),
16
)
compute_node_certificate
=
self
.
portal
.
REQUEST
.
get
(
'compute_node_certificate'
)
self
.
assert
True
(
serial
in
compute_node_certificate
)
self
.
assert
True
(
new_certificate_login
.
getReference
()
in
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
False
(
certificate_login
.
getReference
()
in
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
In
(
serial
,
compute_node_certificate
)
self
.
assert
In
(
new_certificate_login
.
getReference
(),
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
NotIn
(
certificate_login
.
getReference
(),
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
self
.
compute_node
.
getReference
())
...
...
@@ -399,8 +399,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
getDestinationReference
(),
None
)
serial
=
'0x%x'
%
int
(
certificate_login
.
getDestinationReference
(),
16
)
self
.
assert
True
(
serial
in
compute_node_certificate
)
self
.
assert
True
(
certificate_login
.
getReference
()
in
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
In
(
serial
,
compute_node_certificate
)
self
.
assert
In
(
certificate_login
.
getReference
(),
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
self
.
compute_node
.
getReference
())
self
.
assertNotEqual
(
None
,
destination_reference
)
...
...
@@ -434,9 +434,9 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
serial
=
'0x%x'
%
int
(
new_certificate_login
.
getDestinationReference
(),
16
)
compute_node_certificate
=
self
.
portal
.
REQUEST
.
get
(
'compute_node_certificate'
)
self
.
assert
True
(
serial
in
compute_node_certificate
)
self
.
assert
True
(
new_certificate_login
.
getReference
()
in
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
False
(
certificate_login
.
getReference
()
in
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
In
(
serial
,
compute_node_certificate
)
self
.
assert
In
(
new_certificate_login
.
getReference
(),
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
NotIn
(
certificate_login
.
getReference
(),
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
self
.
compute_node
.
getReference
())
...
...
@@ -471,9 +471,9 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
serial
=
'0x%x'
%
int
(
third_certificate_login
.
getDestinationReference
(),
16
)
compute_node_certificate
=
self
.
portal
.
REQUEST
.
get
(
'compute_node_certificate'
)
self
.
assert
True
(
serial
in
compute_node_certificate
)
self
.
assert
True
(
third_certificate_login
.
getReference
()
in
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
False
(
new_certificate_login
.
getReference
()
in
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
In
(
serial
,
compute_node_certificate
)
self
.
assert
In
(
third_certificate_login
.
getReference
(),
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assert
NotIn
(
new_certificate_login
.
getReference
(),
compute_node_certificate
.
decode
(
'string_escape'
))
self
.
assertNotEqual
(
third_certificate_login
.
getReference
(),
self
.
compute_node
.
getReference
())
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudConstraint.py
View file @
ccbf6e16
...
...
@@ -21,7 +21,7 @@ class TestSlapOSConstraintMixin(SlapOSTestCaseMixin):
current_message_list
=
self
.
getMessageList
(
obj
)
# test the test: no expected message found
self
.
assert
False
(
consistency_message
in
current_message_list
)
self
.
assert
NotIn
(
consistency_message
,
current_message_list
)
# required
...
...
@@ -33,14 +33,14 @@ class TestSlapOSConstraintMixin(SlapOSTestCaseMixin):
# ...but in case of magic ones (reference->default_reference)
# use setter to set it to None
obj
.
edit
(
**
{
property_id
:
None
})
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
obj
))
self
.
assert
In
(
consistency_message
,
self
.
getMessageList
(
obj
))
if
empty_string
:
obj
.
edit
(
**
{
property_id
:
''
})
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
obj
))
self
.
assert
In
(
consistency_message
,
self
.
getMessageList
(
obj
))
obj
.
edit
(
**
{
property_id
:
value
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
obj
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
obj
))
self
.
assertSameSet
(
current_message_list
,
self
.
getMessageList
(
obj
))
class
TestSlapOSComputePartitionConstraint
(
TestSlapOSConstraintMixin
):
...
...
@@ -63,14 +63,14 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin):
# test the test: no expected message found
current_message_list
=
self
.
getMessageList
(
partition
)
self
.
assert
False
(
consistency_message
in
current_message_list
)
self
.
assert
NotIn
(
consistency_message
,
current_message_list
)
# check case for Software Instance
software_instance
.
setAggregate
(
partition
.
getRelativeUrl
())
software_instance
.
immediateReindexObject
()
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
partition
))
self
.
assert
In
(
consistency_message
,
self
.
getMessageList
(
partition
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
partition
,
'busy'
)
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
partition
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
partition
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
partition
,
'free'
)
software_instance
.
setAggregate
(
None
)
software_instance
.
immediateReindexObject
()
...
...
@@ -78,9 +78,9 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin):
# check case fo Slave Instance
slave_instance
.
setAggregate
(
partition
.
getRelativeUrl
())
slave_instance
.
immediateReindexObject
()
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
partition
))
self
.
assert
In
(
consistency_message
,
self
.
getMessageList
(
partition
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
partition
,
'busy'
)
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
partition
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
partition
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
partition
,
'free'
)
def
test_busy_partition_has_one_related_instance
(
self
):
...
...
@@ -110,12 +110,12 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin):
# test the test: no expected message found
current_message_list
=
self
.
getMessageList
(
partition
)
self
.
assert
False
(
consistency_message
in
current_message_list
)
self
.
assert
NotIn
(
consistency_message
,
current_message_list
)
# check case for Software Instance
software_instance
.
edit
(
aggregate
=
None
)
software_instance
.
immediateReindexObject
()
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
partition
))
self
.
assert
In
(
consistency_message
,
self
.
getMessageList
(
partition
))
# check case for many Software Instance
software_instance
.
edit
(
aggregate
=
partition
.
getRelativeUrl
())
...
...
@@ -125,7 +125,7 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin):
consistency_message_2
=
"Arity Error for Relation ['default_aggregate'] and"
\
" Type ('Software Instance',), arity is equal to 2 but should be "
\
"between 1 and 1"
self
.
assert
True
(
consistency_message_2
in
self
.
getMessageList
(
partition
))
self
.
assert
In
(
consistency_message_2
,
self
.
getMessageList
(
partition
))
# check case for many Slave Instane
software_instance_2
.
edit
(
aggregate
=
None
)
...
...
@@ -134,8 +134,8 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin):
slave_instance_2
.
edit
(
aggregate
=
partition
.
getRelativeUrl
())
slave_instance
.
immediateReindexObject
()
slave_instance_2
.
immediateReindexObject
()
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
partition
))
self
.
assert
False
(
consistency_message_2
in
self
.
getMessageList
(
partition
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
partition
))
self
.
assert
NotIn
(
consistency_message_2
,
self
.
getMessageList
(
partition
))
class
TestSlapOSSoftwareInstanceConstraint
(
TestSlapOSConstraintMixin
):
def
afterSetUp
(
self
):
...
...
@@ -153,16 +153,16 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
"found, line 1, column 1 (line 1)"
# test the test: no expected message found
self
.
assert
False
(
consistency_message
in
current_message_list
)
self
.
assert
NotIn
(
consistency_message
,
current_message_list
)
# connection_xml is optional
self
.
software_instance
.
edit
(
connection_xml
=
None
)
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
assertSameSet
(
current_message_list
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
software_instance
.
edit
(
connection_xml
=
''
)
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
assertSameSet
(
current_message_list
,
self
.
getMessageList
(
self
.
software_instance
))
# if available shall be correct XML
...
...
@@ -172,7 +172,7 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
self
.
getMessageList
(
self
.
software_instance
)))
self
.
software_instance
.
edit
(
connection_xml
=
self
.
generateEmptyXml
())
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
assertSameSet
(
current_message_list
,
self
.
getMessageList
(
self
.
software_instance
))
def
test_property_existence_source_reference
(
self
):
...
...
@@ -182,10 +182,10 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
'has never been set'
# not required in draft state
self
.
software_instance
.
edit
(
**
{
property_id
:
None
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
software_instance
.
edit
(
**
{
property_id
:
''
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'start_requested'
)
...
...
@@ -208,10 +208,10 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'destroy_requested'
)
self
.
software_instance
.
edit
(
**
{
property_id
:
None
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
software_instance
.
edit
(
**
{
property_id
:
''
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
def
test_property_existence_ssl_key
(
self
):
property_id
=
'ssl_key'
...
...
@@ -224,10 +224,10 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'destroy_requested'
)
self
.
software_instance
.
edit
(
**
{
property_id
:
None
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
software_instance
.
edit
(
**
{
property_id
:
''
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
def
test_successor_related
(
self
):
software_instance2
=
self
.
portal
.
software_instance_module
.
newContent
(
...
...
@@ -243,24 +243,24 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
consistency_message
=
"There is more then one related successor"
# test the test: no expected message found
self
.
assert
False
(
consistency_message
in
current_message_list
)
self
.
assert
NotIn
(
consistency_message
,
current_message_list
)
# if too many, it shall cry
software_instance2
.
edit
(
successor
=
self
.
software_instance
.
getRelativeUrl
())
software_instance3
.
edit
(
successor
=
self
.
software_instance
.
getRelativeUrl
())
self
.
tic
()
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
In
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
# one is good
software_instance2
.
edit
(
successor
=
None
)
self
.
tic
()
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
assertSameSet
(
current_message_list
,
self
.
getMessageList
(
self
.
software_instance
))
# none is good
software_instance3
.
edit
(
successor
=
None
)
self
.
tic
()
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
assertSameSet
(
current_message_list
,
self
.
getMessageList
(
self
.
software_instance
))
def
test_sla_xml
(
self
):
...
...
@@ -271,16 +271,16 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
"found, line 1, column 1 (line 1)"
# test the test: no expected message found
self
.
assert
False
(
consistency_message
in
current_message_list
)
self
.
assert
NotIn
(
consistency_message
,
current_message_list
)
# sla_xml is optional
self
.
software_instance
.
edit
(
sla_xml
=
None
)
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
assertSameSet
(
current_message_list
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
software_instance
.
edit
(
sla_xml
=
''
)
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
assertSameSet
(
current_message_list
,
self
.
getMessageList
(
self
.
software_instance
))
# if available shall be correct XML
...
...
@@ -290,7 +290,7 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
self
.
getMessageList
(
self
.
software_instance
)))
self
.
software_instance
.
edit
(
sla_xml
=
self
.
generateEmptyXml
())
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
assertSameSet
(
current_message_list
,
self
.
getMessageList
(
self
.
software_instance
))
def
test_text_content
(
self
):
...
...
@@ -301,16 +301,16 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
"found, line 1, column 1 (line 1)"
# test the test: no expected message found
self
.
assert
False
(
consistency_message
in
current_message_list
)
self
.
assert
NotIn
(
consistency_message
,
current_message_list
)
# text_content is optional
self
.
software_instance
.
edit
(
text_content
=
None
)
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
assertSameSet
(
current_message_list
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
software_instance
.
edit
(
text_content
=
''
)
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
assertSameSet
(
current_message_list
,
self
.
getMessageList
(
self
.
software_instance
))
# if available shall be correct XML
...
...
@@ -320,7 +320,7 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
self
.
getMessageList
(
self
.
software_instance
)))
self
.
software_instance
.
edit
(
text_content
=
self
.
generateEmptyXml
())
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
assertSameSet
(
current_message_list
,
self
.
getMessageList
(
self
.
software_instance
))
class
TestSlapOSSlaveInstanceConstraint
(
TestSlapOSConstraintMixin
):
...
...
@@ -338,10 +338,10 @@ class TestSlapOSSlaveInstanceConstraint(TestSlapOSConstraintMixin):
property_id
=
'source_reference'
# not required in draft state
self
.
software_instance
.
edit
(
**
{
property_id
:
None
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
software_instance
.
edit
(
**
{
property_id
:
''
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'start_requested'
)
...
...
@@ -355,10 +355,10 @@ class TestSlapOSSlaveInstanceConstraint(TestSlapOSConstraintMixin):
property_id
=
'text_content'
# not required in draft state
self
.
software_instance
.
edit
(
**
{
property_id
:
None
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
software_instance
.
edit
(
**
{
property_id
:
''
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'start_requested'
)
...
...
@@ -384,24 +384,24 @@ class TestSlapOSSlaveInstanceConstraint(TestSlapOSConstraintMixin):
consistency_message
=
"There is more then one related successor"
# test the test: no expected message found
self
.
assert
False
(
consistency_message
in
current_message_list
)
self
.
assert
NotIn
(
consistency_message
,
current_message_list
)
# if too many, it shall cry
software_instance2
.
edit
(
successor
=
self
.
software_instance
.
getRelativeUrl
())
software_instance3
.
edit
(
successor
=
self
.
software_instance
.
getRelativeUrl
())
self
.
tic
()
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
In
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
# one is good
software_instance2
.
edit
(
successor
=
None
)
self
.
tic
()
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
assertSameSet
(
current_message_list
,
self
.
getMessageList
(
self
.
software_instance
))
# none is good
software_instance3
.
edit
(
successor
=
None
)
self
.
tic
()
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
assertSameSet
(
current_message_list
,
self
.
getMessageList
(
self
.
software_instance
))
class
TestSlapOSInstanceTreeConstraint
(
TestSlapOSConstraintMixin
):
...
...
@@ -429,10 +429,10 @@ class TestSlapOSInstanceTreeConstraint(TestSlapOSConstraintMixin):
'has never been set'
# not required in draft state
self
.
software_instance
.
edit
(
**
{
property_id
:
None
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
software_instance
.
edit
(
**
{
property_id
:
''
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'start_requested'
)
...
...
@@ -446,10 +446,10 @@ class TestSlapOSInstanceTreeConstraint(TestSlapOSConstraintMixin):
'has never been set'
# not required in draft state
self
.
software_instance
.
edit
(
**
{
property_id
:
None
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
software_instance
.
edit
(
**
{
property_id
:
''
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'start_requested'
)
...
...
@@ -463,10 +463,10 @@ class TestSlapOSInstanceTreeConstraint(TestSlapOSConstraintMixin):
'has never been set'
# not required in draft state
self
.
software_instance
.
edit
(
**
{
property_id
:
None
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
software_instance
.
edit
(
**
{
property_id
:
''
})
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
self
.
software_instance
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
self
.
software_instance
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'start_requested'
)
...
...
@@ -478,17 +478,17 @@ class TestSlapOSPersonConstraint(TestSlapOSConstraintMixin):
def
test_role
(
self
):
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
consistency_message
=
'One role should be defined'
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
person
))
self
.
assert
In
(
consistency_message
,
self
.
getMessageList
(
person
))
role_id_list
=
list
(
self
.
portal
.
portal_categories
.
role
.
objectIds
())
self
.
assertTrue
(
len
(
role_id_list
)
>=
2
)
person
.
setRole
(
role_id_list
[
0
])
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
person
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
person
))
person
.
setRoleList
(
role_id_list
)
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
person
))
self
.
assert
In
(
consistency_message
,
self
.
getMessageList
(
person
))
person
.
setRole
(
role_id_list
[
0
])
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
person
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
person
))
def
test_subordination_state
(
self
):
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
...
...
@@ -497,21 +497,21 @@ class TestSlapOSPersonConstraint(TestSlapOSConstraintMixin):
subordination
=
organisation
.
getRelativeUrl
())
consistency_message
=
'The Organisation is not validated'
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
person
))
self
.
assert
In
(
consistency_message
,
self
.
getMessageList
(
person
))
organisation
.
validate
()
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
person
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
person
))
def
test_email
(
self
):
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
consistency_message
=
'Person have to contain an Email'
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
person
))
self
.
assert
In
(
consistency_message
,
self
.
getMessageList
(
person
))
person
.
newContent
(
portal_type
=
'Email'
)
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
person
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
person
))
class
TestSlapOSAssignmentConstraint
(
TestSlapOSConstraintMixin
):
def
test_parent_person_validated
(
self
):
...
...
@@ -520,11 +520,11 @@ class TestSlapOSAssignmentConstraint(TestSlapOSConstraintMixin):
consistency_message
=
'The person document has to be validated to start '
\
'assignment'
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
assignment
))
self
.
assert
In
(
consistency_message
,
self
.
getMessageList
(
assignment
))
person
.
validate
()
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
assignment
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
assignment
))
class
TestSlapOSEmailConstraint
(
TestSlapOSConstraintMixin
):
def
test_url_string_not_empty
(
self
):
...
...
@@ -532,20 +532,20 @@ class TestSlapOSEmailConstraint(TestSlapOSConstraintMixin):
).
newContent
(
portal_type
=
'Email'
)
consistency_message
=
'Email must be defined'
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
email
))
self
.
assert
In
(
consistency_message
,
self
.
getMessageList
(
email
))
email
.
setUrlString
(
self
.
generateNewId
())
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
email
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
email
))
class
TestSlapOSComputeNodeConstraint
(
TestSlapOSConstraintMixin
):
def
test_title_not_empty
(
self
):
compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
'Compute Node'
)
consistency_message
=
'Title must be defined'
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
compute_node
))
self
.
assert
In
(
consistency_message
,
self
.
getMessageList
(
compute_node
))
compute_node
.
setTitle
(
self
.
generateNewId
())
self
.
assert
False
(
consistency_message
in
self
.
getMessageList
(
compute_node
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
compute_node
))
class
TestSlapOSReferenceConstraint
(
TestSlapOSConstraintMixin
):
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow.py
View file @
ccbf6e16
...
...
@@ -1337,8 +1337,8 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
getDestinationReference
(),
None
)
serial
=
'0x%x'
%
int
(
certificate_login
.
getDestinationReference
(),
16
)
self
.
assert
True
(
serial
in
self
.
software_instance
.
getSslCertificate
())
self
.
assert
True
(
certificate_login
.
getReference
()
in
\
self
.
assert
In
(
serial
,
self
.
software_instance
.
getSslCertificate
())
self
.
assert
In
(
certificate_login
.
getReference
(),
\
self
.
software_instance
.
getSslCertificate
().
decode
(
'string_escape'
))
self
.
assertRaises
(
ValueError
,
self
.
software_instance
.
generateCertificate
)
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudSecurityGroup.py
View file @
ccbf6e16
...
...
@@ -100,7 +100,7 @@ class TestSlapOSComputeNodeSecurity(TestSlapOSSecurityMixin):
self
.
login
(
user_id
)
user
=
getSecurityManager
().
getUser
()
self
.
assert
True
(
'Authenticated'
in
user
.
getRoles
())
self
.
assert
In
(
'Authenticated'
,
user
.
getRoles
())
self
.
assertSameSet
([
'R-COMPUTER'
],
user
.
getGroups
())
...
...
@@ -136,7 +136,7 @@ class TestSlapOSSoftwareInstanceSecurity(TestSlapOSSecurityMixin):
# instance w/o subscription is loggable and it has some roles
self
.
login
(
user_id
)
user
=
getSecurityManager
().
getUser
()
self
.
assert
True
(
'Authenticated'
in
user
.
getRoles
())
self
.
assert
In
(
'Authenticated'
,
user
.
getRoles
())
self
.
assertSameSet
([
'R-INSTANCE'
],
user
.
getGroups
())
...
...
@@ -154,7 +154,7 @@ class TestSlapOSSoftwareInstanceSecurity(TestSlapOSSecurityMixin):
self
.
portal
.
portal_caches
.
clearAllCache
()
self
.
login
(
user_id
)
user
=
getSecurityManager
().
getUser
()
self
.
assert
True
(
'Authenticated'
in
user
.
getRoles
())
self
.
assert
In
(
'Authenticated'
,
user
.
getRoles
())
self
.
assertSameSet
([
'R-INSTANCE'
,
subscription_reference
],
user
.
getGroups
())
...
...
@@ -196,7 +196,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self
.
login
(
person
.
getUserId
())
user
=
getSecurityManager
().
getUser
()
self
.
assert
True
(
'Authenticated'
in
user
.
getRoles
())
self
.
assert
In
(
'Authenticated'
,
user
.
getRoles
())
self
.
assertSameSet
([],
user
.
getGroups
())
...
...
@@ -209,7 +209,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self
.
portal
.
portal_caches
.
clearAllCache
()
self
.
login
(
person
.
getUserId
())
user
=
getSecurityManager
().
getUser
()
self
.
assert
True
(
'Authenticated'
in
user
.
getRoles
())
self
.
assert
In
(
'Authenticated'
,
user
.
getRoles
())
self
.
assertSameSet
([
'G-COMPANY'
],
user
.
getGroups
())
# add to role category
...
...
@@ -220,7 +220,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self
.
portal
.
portal_caches
.
clearAllCache
()
self
.
login
(
person
.
getUserId
())
user
=
getSecurityManager
().
getUser
()
self
.
assert
True
(
'Authenticated'
in
user
.
getRoles
())
self
.
assert
In
(
'Authenticated'
,
user
.
getRoles
())
self
.
assertSameSet
([
'R-MEMBER'
,
'G-COMPANY'
],
user
.
getGroups
())
# add to role for project
...
...
@@ -236,7 +236,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self
.
portal
.
portal_caches
.
clearAllCache
()
self
.
login
(
person
.
getUserId
())
user
=
getSecurityManager
().
getUser
()
self
.
assert
True
(
'Authenticated'
in
user
.
getRoles
())
self
.
assert
In
(
'Authenticated'
,
user
.
getRoles
())
self
.
assertSameSet
([
'R-MEMBER'
,
'G-COMPANY'
,
project
.
getReference
()],
user
.
getGroups
())
# add to role for project
...
...
@@ -253,7 +253,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self
.
portal
.
portal_caches
.
clearAllCache
()
self
.
login
(
person
.
getUserId
())
user
=
getSecurityManager
().
getUser
()
self
.
assert
True
(
'Authenticated'
in
user
.
getRoles
())
self
.
assert
In
(
'Authenticated'
,
user
.
getRoles
())
self
.
assertSameSet
([
'R-MEMBER'
,
'G-COMPANY'
,
organisation
.
getReference
(),
project
.
getReference
()],
user
.
getGroups
())
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudShadow.py
View file @
ccbf6e16
...
...
@@ -54,7 +54,7 @@ class TestSlapOSShadowPerson(TestSlapOSSecurityMixin):
self
.
login
(
shadow_user_id
)
user
=
getSecurityManager
().
getUser
()
self
.
assert
True
(
'Authenticated'
in
user
.
getRoles
())
self
.
assert
In
(
'Authenticated'
,
user
.
getRoles
())
self
.
assertSameSet
([
'R-SHADOW-PERSON'
,
'SHADOW-%s'
%
user_id
],
user
.
getGroups
())
...
...
@@ -95,7 +95,7 @@ class TestSlapOSShadowComputeNode(TestSlapOSSecurityMixin):
self
.
login
(
shadow_user_id
)
user
=
getSecurityManager
().
getUser
()
self
.
assert
True
(
'Authenticated'
in
user
.
getRoles
())
self
.
assert
In
(
'Authenticated'
,
user
.
getRoles
())
self
.
assertSameSet
([
'R-SHADOW-COMPUTENODE'
,
'SHADOW-%s'
%
user_id
],
user
.
getGroups
())
...
...
@@ -135,7 +135,7 @@ class TestSlapOSShadowSoftwareInstance(TestSlapOSSecurityMixin):
self
.
login
(
shadow_user_id
)
user
=
getSecurityManager
().
getUser
()
self
.
assert
True
(
'Authenticated'
in
user
.
getRoles
())
self
.
assert
In
(
'Authenticated'
,
user
.
getRoles
())
self
.
assertSameSet
([
'R-SHADOW-SOFTWAREINSTANCE'
,
'SHADOW-%s'
%
user_id
],
user
.
getGroups
())
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudUpgrader.py
View file @
ccbf6e16
...
...
@@ -32,29 +32,29 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
)
# Nothing to migrate
self
.
assert
False
(
migration_message
in
getMessageList
(
instance_nothing_to_migrate
))
self
.
assert
False
(
error_message
in
getMessageList
(
instance_nothing_to_migrate
))
self
.
assert
NotIn
(
migration_message
,
getMessageList
(
instance_nothing_to_migrate
))
self
.
assert
NotIn
(
error_message
,
getMessageList
(
instance_nothing_to_migrate
))
# Migrate
self
.
assert
True
(
migration_message
in
getMessageList
(
instance_to_migrate
))
self
.
assert
False
(
error_message
in
getMessageList
(
instance_to_migrate
))
self
.
assert
In
(
migration_message
,
getMessageList
(
instance_to_migrate
))
self
.
assert
NotIn
(
error_message
,
getMessageList
(
instance_to_migrate
))
instance_to_migrate
.
fixConsistency
()
self
.
assertEqual
(
None
,
instance_to_migrate
.
getPredecessor
())
self
.
assertEqual
(
instance_nothing_to_migrate
.
getRelativeUrl
(),
instance_to_migrate
.
getSuccessor
())
self
.
assert
False
(
migration_message
in
getMessageList
(
instance_to_migrate
))
self
.
assert
False
(
error_message
in
getMessageList
(
instance_to_migrate
))
self
.
assert
NotIn
(
migration_message
,
getMessageList
(
instance_to_migrate
))
self
.
assert
NotIn
(
error_message
,
getMessageList
(
instance_to_migrate
))
# Error
self
.
assert
False
(
migration_message
in
getMessageList
(
instance_badly_migrated
))
self
.
assert
True
(
error_message
in
getMessageList
(
instance_badly_migrated
))
self
.
assert
NotIn
(
migration_message
,
getMessageList
(
instance_badly_migrated
))
self
.
assert
In
(
error_message
,
getMessageList
(
instance_badly_migrated
))
instance_badly_migrated
.
fixConsistency
()
self
.
assertEqual
(
instance_nothing_to_migrate
.
getRelativeUrl
(),
instance_badly_migrated
.
getPredecessor
())
self
.
assertEqual
(
instance_nothing_to_migrate
.
getRelativeUrl
(),
instance_badly_migrated
.
getSuccessor
())
self
.
assert
False
(
migration_message
in
getMessageList
(
instance_badly_migrated
))
self
.
assert
True
(
error_message
in
getMessageList
(
instance_badly_migrated
))
self
.
assert
NotIn
(
migration_message
,
getMessageList
(
instance_badly_migrated
))
self
.
assert
In
(
error_message
,
getMessageList
(
instance_badly_migrated
))
def
test_upgrade_software_instance_predecessor
(
self
):
return
self
.
check_upgrade_instance_predecessor
(
'Software Instance'
)
...
...
@@ -107,10 +107,10 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
self
.
tic
()
# Nothing to migrate
self
.
assert
False
(
migration_message
in
getMessageList
(
hosting_subscription_nothing_to_migrate
))
self
.
assert
NotIn
(
migration_message
,
getMessageList
(
hosting_subscription_nothing_to_migrate
))
# To migrate
self
.
assert
True
(
migration_message
in
getMessageList
(
hosting_subscription_to_migrate
))
self
.
assert
In
(
migration_message
,
getMessageList
(
hosting_subscription_to_migrate
))
hosting_subscription_to_migrate
.
fixConsistency
()
self
.
commit
()
...
...
@@ -145,8 +145,8 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
migrated_instance_tree
.
getCreationDate
())
# self.assertEqual(modification_date,
# migrated_instance_tree.getModificationDate())
self
.
assert
False
(
'hosting_subscription_workflow'
in
migrated_instance_tree
.
workflow_history
)
self
.
assert
False
(
migration_message
in
getMessageList
(
migrated_instance_tree
))
self
.
assert
NotIn
(
'hosting_subscription_workflow'
,
migrated_instance_tree
.
workflow_history
)
self
.
assert
NotIn
(
migration_message
,
getMessageList
(
migrated_instance_tree
))
self
.
assertEqual
(
migrated_instance_tree
.
getRelativeUrl
(),
software_instance
.
getAggregate
())
self
.
assertEqual
(
1
,
len
(
self
.
portal
.
portal_catalog
(
uid
=
migrated_instance_tree
.
getUid
())))
...
...
@@ -213,10 +213,10 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
self
.
tic
()
# Nothing to migrate
self
.
assert
False
(
migration_message
in
getMessageList
(
computer_nothing_to_migrate
))
self
.
assert
NotIn
(
migration_message
,
getMessageList
(
computer_nothing_to_migrate
))
# To migrate
self
.
assert
True
(
migration_message
in
getMessageList
(
computer_to_migrate
))
self
.
assert
In
(
migration_message
,
getMessageList
(
computer_to_migrate
))
computer_to_migrate
.
fixConsistency
()
self
.
commit
()
...
...
@@ -258,9 +258,9 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
migrated_compute_node
.
getCreationDate
())
# self.assertEqual(modification_date,
# migrated_compute_node.getModificationDate())
self
.
assert
False
(
'computer_slap_interface_workflow'
in
migrated_compute_node
.
workflow_history
)
self
.
assert
NotIn
(
'computer_slap_interface_workflow'
,
migrated_compute_node
.
workflow_history
)
self
.
assert
False
(
migration_message
in
getMessageList
(
migrated_compute_node
))
self
.
assert
NotIn
(
migration_message
,
getMessageList
(
migrated_compute_node
))
self
.
assertEqual
(
migrated_compute_node
.
getRelativeUrl
(),
software_installation
.
getAggregate
())
self
.
assertEqual
(
migrated_computer_partition
.
getRelativeUrl
(),
...
...
@@ -318,10 +318,10 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
self
.
tic
()
# Nothing to migrate
self
.
assert
False
(
migration_message
in
getMessageList
(
computer_nothing_to_migrate
))
self
.
assert
NotIn
(
migration_message
,
getMessageList
(
computer_nothing_to_migrate
))
# To migrate
self
.
assert
True
(
migration_message
in
getMessageList
(
computer_partition_to_migrate
))
self
.
assert
In
(
migration_message
,
getMessageList
(
computer_partition_to_migrate
))
computer_partition_to_migrate
.
fixConsistency
()
self
.
commit
()
...
...
@@ -344,8 +344,8 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
migrated_computer_partition
.
getCreationDate
())
# self.assertEqual(modification_date,
# migrated_compute_node.getModificationDate())
self
.
assert
False
(
'computer_partition_slap_interface_workflow'
in
migrated_computer_partition
.
workflow_history
)
self
.
assert
NotIn
(
'computer_partition_slap_interface_workflow'
,
migrated_computer_partition
.
workflow_history
)
self
.
assert
False
(
migration_message
in
getMessageList
(
computer_partition_to_migrate
))
self
.
assert
NotIn
(
migration_message
,
getMessageList
(
computer_partition_to_migrate
))
self
.
assertEqual
(
1
,
len
(
self
.
portal
.
portal_catalog
(
uid
=
migrated_computer_partition
.
getUid
())))
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
View file @
ccbf6e16
...
...
@@ -28,6 +28,8 @@ from Products.ERP5Type.Cache import DEFAULT_CACHE_SCOPE
from
DateTime
import
DateTime
import
json
import
transaction
from
six.moves
import
urllib
def
_decode_with_json
(
value
):
# Ensure value is serisalisable as json
...
...
@@ -62,6 +64,18 @@ class TestSlapOSHalJsonStyleMixin(SlapOSTestCaseMixinWithAbort):
return
'https://monitor.app.officejs.com/#/?username=testuser&url=softinst-monitored/public/feeds&password=testpass&page=ojsm_dispatch&query=portal_type%3A%22Instance%20Tree%22%20AND%20title%3A%22Template%20Instance%20Tree%22'
return
''
def
assertMonitorURLEqual
(
self
,
first
,
second
):
first_url_parsed
=
urllib
.
parse
.
urlparse
(
first
)
second_url_parsed
=
urllib
.
parse
.
urlparse
(
second
)
self
.
assertEqual
(
first_url_parsed
.
_replace
(
fragment
=
''
),
second_url_parsed
.
_replace
(
fragment
=
''
))
self
.
assertEqual
(
first_url_parsed
.
fragment
[:
2
],
second_url_parsed
.
fragment
[:
2
])
if
first_url_parsed
.
fragment
:
# in monitoring url, the fragment is /? and the parameters encoded like a query string
self
.
assertEqual
(
first_url_parsed
.
fragment
[:
2
],
'/?'
)
self
.
assertEqual
(
urllib
.
parse
.
parse_qs
(
first_url_parsed
.
fragment
[
2
:]),
urllib
.
parse
.
parse_qs
(
second_url_parsed
.
fragment
[
2
:]))
maxDiff
=
None
def
afterSetUp
(
self
):
SlapOSTestCaseMixinWithAbort
.
afterSetUp
(
self
)
...
...
@@ -182,12 +196,14 @@ class TestInstanceTree_getNewsDict(TestSlapOSHalJsonStyleMixin):
def
test
(
self
):
instance_tree
=
self
.
_makeInstanceTree
()
news_dict
=
instance_tree
.
InstanceTree_getNewsDict
()
self
.
assertMonitorURLEqual
(
news_dict
.
pop
(
'monitor_url'
),
self
.
getMonitorUrl
(
instance_tree
))
expected_news_dict
=
{
'instance'
:
[],
'portal_type'
:
instance_tree
.
getPortalType
(),
'reference'
:
instance_tree
.
getReference
(),
'title'
:
instance_tree
.
getTitle
(),
'monitor_url'
:
self
.
getMonitorUrl
(
instance_tree
)
}
self
.
assertEqual
(
_decode_with_json
(
news_dict
),
_decode_with_json
(
expected_news_dict
))
...
...
@@ -196,11 +212,13 @@ class TestInstanceTree_getNewsDict(TestSlapOSHalJsonStyleMixin):
instance_tree
=
self
.
_makeInstanceTree
()
instance_tree
.
setRootSlave
(
1
)
news_dict
=
instance_tree
.
InstanceTree_getNewsDict
()
self
.
assertMonitorURLEqual
(
news_dict
.
pop
(
'monitor_url'
),
self
.
getMonitorUrl
(
instance_tree
))
expected_news_dict
=
{
'instance'
:
[],
'portal_type'
:
instance_tree
.
getPortalType
(),
'reference'
:
instance_tree
.
getReference
(),
'title'
:
instance_tree
.
getTitle
(),
'monitor_url'
:
self
.
getMonitorUrl
(
instance_tree
),
'is_slave'
:
1
}
self
.
assertEqual
(
news_dict
,
...
...
@@ -210,11 +228,13 @@ class TestInstanceTree_getNewsDict(TestSlapOSHalJsonStyleMixin):
instance_tree
=
self
.
_makeInstanceTree
()
instance_tree
.
getSlapState
=
fakeStopRequestedSlapState
news_dict
=
instance_tree
.
InstanceTree_getNewsDict
()
self
.
assertMonitorURLEqual
(
news_dict
.
pop
(
'monitor_url'
),
self
.
getMonitorUrl
(
instance_tree
))
expected_news_dict
=
{
'instance'
:
[],
'portal_type'
:
instance_tree
.
getPortalType
(),
'reference'
:
instance_tree
.
getReference
(),
'title'
:
instance_tree
.
getTitle
(),
'monitor_url'
:
self
.
getMonitorUrl
(
instance_tree
),
'is_stopped'
:
1
}
self
.
assertEqual
(
_decode_with_json
(
news_dict
),
...
...
@@ -224,11 +244,13 @@ class TestInstanceTree_getNewsDict(TestSlapOSHalJsonStyleMixin):
instance_tree
=
self
.
_makeInstanceTree
()
instance_tree
.
getSlapState
=
fakeDestroyRequestedSlapState
news_dict
=
instance_tree
.
InstanceTree_getNewsDict
()
self
.
assertMonitorURLEqual
(
news_dict
.
pop
(
'monitor_url'
),
self
.
getMonitorUrl
(
instance_tree
))
expected_news_dict
=
{
'instance'
:
[],
'portal_type'
:
instance_tree
.
getPortalType
(),
'reference'
:
instance_tree
.
getReference
(),
'title'
:
instance_tree
.
getTitle
(),
'monitor_url'
:
self
.
getMonitorUrl
(
instance_tree
),
'is_destroyed'
:
1
}
self
.
assertEqual
(
_decode_with_json
(
news_dict
),
...
...
@@ -242,17 +264,21 @@ class TestInstanceTree_getNewsDict(TestSlapOSHalJsonStyleMixin):
self
.
tic
()
self
.
changeSkin
(
'Hal'
)
news_dict
=
instance_tree
.
InstanceTree_getNewsDict
()
self
.
assertMonitorURLEqual
(
news_dict
.
pop
(
'monitor_url'
),
self
.
getMonitorUrl
(
instance_tree
))
self
.
assertMonitorURLEqual
(
news_dict
[
'instance'
][
0
].
pop
(
'monitor_url'
),
self
.
getMonitorUrl
(
instance
))
expected_news_dict
=
{
'portal_type'
:
instance_tree
.
getPortalType
(),
'reference'
:
instance_tree
.
getReference
(),
'title'
:
instance_tree
.
getTitle
(),
'monitor_url'
:
self
.
getMonitorUrl
(
instance_tree
),
'instance'
:
[{
'created_at'
:
self
.
created_at
,
'no_data'
:
1
,
'portal_type'
:
instance
.
getPortalType
(),
'reference'
:
instance
.
getReference
(),
'since'
:
self
.
created_at
,
'monitor_url'
:
self
.
getMonitorUrl
(
instance
),
'state'
:
''
,
'text'
:
'#error no data found for %s'
%
instance
.
getReference
(),
'user'
:
'SlapOS Master'
}]
...
...
@@ -268,12 +294,14 @@ class TestInstanceTree_getNewsDict(TestSlapOSHalJsonStyleMixin):
self
.
tic
()
self
.
changeSkin
(
'Hal'
)
news_dict
=
instance_tree
.
InstanceTree_getNewsDict
()
self
.
assertMonitorURLEqual
(
news_dict
.
pop
(
'monitor_url'
),
self
.
getMonitorUrl
(
instance_tree
))
expected_news_dict
=
{
'portal_type'
:
instance_tree
.
getPortalType
(),
'reference'
:
instance_tree
.
getReference
(),
'title'
:
instance_tree
.
getTitle
(),
'instance'
:
[],
'monitor_url'
:
self
.
getMonitorUrl
(
instance_tree
)
}
self
.
assertEqual
(
_decode_with_json
(
news_dict
),
_decode_with_json
(
expected_news_dict
))
...
...
@@ -288,18 +316,25 @@ class TestInstanceTree_getNewsDict(TestSlapOSHalJsonStyleMixin):
self
.
tic
()
self
.
changeSkin
(
'Hal'
)
news_dict
=
instance_tree
.
InstanceTree_getNewsDict
()
self
.
assertMonitorURLEqual
(
news_dict
.
pop
(
'monitor_url'
),
self
.
getMonitorUrl
(
instance_tree
))
self
.
assertMonitorURLEqual
(
news_dict
[
'instance'
][
0
].
pop
(
'monitor_url'
),
self
.
getMonitorUrl
(
instance0
))
self
.
assertMonitorURLEqual
(
news_dict
[
'instance'
][
1
].
pop
(
'monitor_url'
),
self
.
getMonitorUrl
(
instance
))
expected_news_dict
=
{
'portal_type'
:
instance_tree
.
getPortalType
(),
'reference'
:
instance_tree
.
getReference
(),
'title'
:
instance_tree
.
getTitle
(),
'monitor_url'
:
self
.
getMonitorUrl
(
instance_tree
),
'instance'
:
[
{
'created_at'
:
self
.
created_at
,
'no_data'
:
1
,
'portal_type'
:
instance0
.
getPortalType
(),
'reference'
:
instance0
.
getReference
(),
'since'
:
self
.
created_at
,
'monitor_url'
:
self
.
getMonitorUrl
(
instance0
),
'state'
:
''
,
'text'
:
'#error no data found for %s'
%
instance0
.
getReference
(),
'user'
:
'SlapOS Master'
},
...
...
@@ -308,7 +343,6 @@ class TestInstanceTree_getNewsDict(TestSlapOSHalJsonStyleMixin):
'portal_type'
:
instance
.
getPortalType
(),
'reference'
:
instance
.
getReference
(),
'since'
:
self
.
created_at
,
'monitor_url'
:
self
.
getMonitorUrl
(
instance
),
'state'
:
''
,
'text'
:
'#error no data found for %s'
%
instance
.
getReference
(),
'user'
:
'SlapOS Master'
}]}
...
...
@@ -325,12 +359,14 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
instance_tree
.
edit
(
successor_value
=
instance
)
self
.
_logFakeAccess
(
instance
)
news_dict
=
instance
.
SoftwareInstance_getNewsDict
()
self
.
assertMonitorURLEqual
(
news_dict
.
pop
(
'monitor_url'
),
self
.
getMonitorUrl
(
instance
))
expected_news_dict
=
{
'created_at'
:
self
.
created_at
,
'no_data_since_15_minutes'
:
0
,
'no_data_since_5_minutes'
:
0
,
'portal_type'
:
instance
.
getPortalType
(),
'reference'
:
instance
.
getReference
(),
'monitor_url'
:
self
.
getMonitorUrl
(
instance
),
'since'
:
self
.
created_at
,
'state'
:
'start_requested'
,
'text'
:
'#access OK'
,
...
...
@@ -347,6 +383,9 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
self
.
changeSkin
(
'Hal'
)
news_dict
=
instance
.
SoftwareInstance_getNewsDict
()
self
.
assertMonitorURLEqual
(
news_dict
.
pop
(
'monitor_url'
),
self
.
getMonitorUrl
(
instance
))
expected_news_dict
=
{
'created_at'
:
self
.
created_at
,
'no_data'
:
1
,
'portal_type'
:
instance
.
getPortalType
(),
...
...
@@ -354,7 +393,6 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
'since'
:
self
.
created_at
,
'state'
:
''
,
'text'
:
'#error no data found for %s'
%
instance
.
getReference
(),
'monitor_url'
:
self
.
getMonitorUrl
(
instance
),
'user'
:
'SlapOS Master'
}
self
.
assertEqual
(
_decode_with_json
(
news_dict
),
...
...
@@ -366,12 +404,14 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
instance
.
edit
(
specialise_value
=
instance_tree
)
instance_tree
.
edit
(
successor_value
=
instance
)
news_dict
=
instance
.
SoftwareInstance_getNewsDict
()
self
.
assertMonitorURLEqual
(
news_dict
.
pop
(
'monitor_url'
),
'https://monitor.app.officejs.com/#/?username=testuser&url=softinst-monitored/public/feeds&password=testpass&page=ojsm_dispatch&query=portal_type%3A%22Software%20Instance%22%20AND%20title%3A%22Template%20Slave%20Instance%22%20AND%20specialise_title%3A%22Template%20Instance%20Tree%22'
)
expected_news_dict
=
{
'portal_type'
:
instance
.
getPortalType
(),
'reference'
:
instance
.
getReference
(),
'is_slave'
:
1
,
'text'
:
'#nodata is a slave %s'
%
instance
.
getReference
(),
'monitor_url'
:
'https://monitor.app.officejs.com/#/?username=testuser&url=softinst-monitored/public/feeds&password=testpass&page=ojsm_dispatch&query=portal_type%3A%22Software%20Instance%22%20AND%20title%3A%22Template%20Slave%20Instance%22%20AND%20specialise_title%3A%22Template%20Instance%20Tree%22'
,
'user'
:
'SlapOS Master'
}
self
.
assertEqual
(
_decode_with_json
(
news_dict
),
_decode_with_json
(
expected_news_dict
))
...
...
@@ -383,12 +423,14 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
instance_tree
.
edit
(
successor_value
=
instance
)
instance
.
getSlapState
=
fakeStopRequestedSlapState
news_dict
=
instance
.
SoftwareInstance_getNewsDict
()
self
.
assertMonitorURLEqual
(
news_dict
.
pop
(
'monitor_url'
),
self
.
getMonitorUrl
(
instance
))
expected_news_dict
=
{
"portal_type"
:
instance
.
getPortalType
(),
"reference"
:
instance
.
getReference
(),
"user"
:
"SlapOS Master"
,
"text"
:
"#nodata is an stopped instance %s"
%
instance
.
getReference
(),
'monitor_url'
:
self
.
getMonitorUrl
(
instance
),
"is_stopped"
:
1
}
self
.
assertEqual
(
_decode_with_json
(
news_dict
),
...
...
@@ -400,12 +442,14 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
instance
.
edit
(
specialise_value
=
instance_tree
)
instance
.
getSlapState
=
fakeDestroyRequestedSlapState
news_dict
=
instance
.
SoftwareInstance_getNewsDict
()
self
.
assertMonitorURLEqual
(
news_dict
.
pop
(
'monitor_url'
),
self
.
getMonitorUrl
(
instance
))
expected_news_dict
=
{
"portal_type"
:
instance
.
getPortalType
(),
"reference"
:
instance
.
getReference
(),
"user"
:
"SlapOS Master"
,
"text"
:
"#nodata is an destroyed instance %s"
%
instance
.
getReference
(),
'monitor_url'
:
self
.
getMonitorUrl
(
instance
),
"is_destroyed"
:
1
}
self
.
assertEqual
(
_decode_with_json
(
news_dict
),
...
...
master/bt5/slapos_jio_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalSlapOSRenderJSOSSUIHalStyle.py
View file @
ccbf6e16
...
...
@@ -37,7 +37,9 @@ class TestSlapOSRenderJSOSSUIHalStyle(SlapOSTestCaseMixin, ERP5TypeFunctionalTes
ERP5TypeFunctionalTestCase
.
afterSetUp
(
self
)
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
# Ensuring the default available language is "en" for English UI test
self
.
getPortalObject
().
web_site_module
.
renderjs_oss
.
setDefaultAvailableLanguage
(
'en'
)
self
.
portal
.
web_site_module
.
renderjs_oss
.
setDefaultAvailableLanguage
(
'en'
)
# fix consistency to update translation
self
.
portal
.
web_site_module
.
renderjs_oss
.
fixConsistency
()
self
.
tic
()
def
test_suite
():
...
...
master/bt5/slapos_jio_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalSlapOSUIZHHalStyle.py
View file @
ccbf6e16
...
...
@@ -37,7 +37,9 @@ class TestSlapOSUIZHHalStyle(SlapOSTestCaseMixin, ERP5TypeFunctionalTestCase):
ERP5TypeFunctionalTestCase
.
afterSetUp
(
self
)
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
# set default available language as "zh" for Chinese UI test
self
.
getPortalObject
().
web_site_module
.
hostingjs
.
setDefaultAvailableLanguage
(
'zh'
)
self
.
portal
.
web_site_module
.
hostingjs
.
setDefaultAvailableLanguage
(
'zh'
)
# fix consistency to update translation
self
.
portal
.
web_site_module
.
hostingjs
.
fixConsistency
()
self
.
tic
()
def
getBusinessTemplateList
(
self
):
...
...
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm.py
View file @
ccbf6e16
...
...
@@ -241,11 +241,11 @@ class TestSlapOSDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm(Slap
self
.
tic
()
v
=
'Visited by SoftwareRelease_findAndDestroySoftwareInstallation'
self
.
assert
False
(
v
in
self
.
assert
NotIn
(
v
,
[
q
[
'comment'
]
for
q
in
published_software_release
.
workflow_history
[
'edit_workflow'
]])
self
.
assert
True
(
v
in
self
.
assert
In
(
v
,
[
q
[
'comment'
]
for
q
in
archived_cleaned_software_release
.
workflow_history
[
'edit_workflow'
]])
self
.
assert
True
(
v
in
self
.
assert
In
(
v
,
[
q
[
'comment'
]
for
q
in
archived_software_release
.
workflow_history
[
'edit_workflow'
]])
@
simulateByEditWorkflowMark
(
'SoftwareInstallation_destroyWithSoftwareReleaseArchived'
)
...
...
@@ -304,9 +304,9 @@ class TestSlapOSDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm(Slap
self
.
tic
()
v
=
'Visited by SoftwareInstallation_destroyWithSoftwareReleaseArchived'
self
.
assert
True
(
v
in
self
.
assert
In
(
v
,
[
q
[
'comment'
]
for
q
in
software_installation_validated_request_start
.
workflow_history
[
'edit_workflow'
]])
self
.
assert
False
(
v
in
self
.
assert
NotIn
(
v
,
[
q
[
'comment'
]
for
q
in
software_installation_validated_request_destroy
.
workflow_history
[
'edit_workflow'
]])
self
.
assert
False
(
v
in
self
.
assert
NotIn
(
v
,
[
q
[
'comment'
]
for
q
in
software_installation_invalidated_request_destroy
.
workflow_history
[
'edit_workflow'
]])
\ No newline at end of file
master/bt5/slapos_rss_style/TestTemplateItem/portal_components/test.erp5.testSlapOSRSSStyleSkins.py
View file @
ccbf6e16
...
...
@@ -127,7 +127,7 @@ class TestSlapOSEvent_getRSSTextContent(TestRSSSyleSkinsMixin):
self
.
portal
.
portal_skins
.
changeSkin
(
'RSS'
)
text_content
=
event
.
Event_getRSSTextContent
()
self
.
assert
True
(
event
.
getTextContent
()
in
text_content
)
self
.
assert
In
(
event
.
getTextContent
(),
text_content
)
self
.
assertTrue
(
"Sender: "
in
text_content
,
"Sender: not in %s"
%
text_content
)
self
.
assertTrue
(
"Recipient: "
in
text_content
,
"Recipient: not in %s"
%
text_content
)
self
.
assertTrue
(
"Content:"
in
text_content
,
"Content: not in %s"
%
text_content
)
...
...
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.py
View file @
ccbf6e16
...
...
@@ -12,7 +12,6 @@ import time
# blurb to make nice XML comparisions
from
lxml
import
etree
import
difflib
import
hashlib
import
json
from
binascii
import
hexlify
...
...
@@ -38,7 +37,16 @@ class Simulator:
l
.
append
({
'recmethod'
:
self
.
method
,
'recargs'
:
args
,
'reckwargs'
:
kwargs
})
open
(
self
.
outfile
,
'w'
).
write
(
repr
(
l
))
with
open
(
self
.
outfile
,
'w'
)
as
f
:
f
.
write
(
repr
(
l
))
def
canonical_xml
(
xml
):
return
etree
.
tostring
(
etree
.
fromstring
(
xml
),
method
=
"c14n"
,
).
decode
(
'utf-8'
)
class
TestSlapOSSlapToolMixin
(
SlapOSTestCaseMixin
):
def
afterSetUp
(
self
):
...
...
@@ -69,6 +77,9 @@ class TestSlapOSSlapToolMixin(SlapOSTestCaseMixin):
self
.
unpinDateTime
()
self
.
_cleaupREQUEST
()
def
assertXMLEqual
(
self
,
first
,
second
):
self
.
assertEqual
(
canonical_xml
(
first
),
canonical_xml
(
second
))
class
TestSlapOSSlapToolgetFullComputerInformation
(
TestSlapOSSlapToolMixin
):
def
test_activate_getFullComputerInformation_first_access
(
self
):
...
...
@@ -92,7 +103,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
)
)
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assert
True
(
'last-modified'
not
in
response
.
headers
)
self
.
assert
NotIn
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
first_etag
,
response
.
headers
.
get
(
'etag'
))
self
.
assertEqual
(
first_body_fingerprint
,
hashData
(
response
.
body
))
self
.
assertEqual
(
0
,
len
(
self
.
portal
.
portal_activities
.
getMessageList
()))
...
...
@@ -108,7 +119,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
response
=
self
.
portal_slap
.
getFullComputerInformation
(
self
.
compute_node_id
)
self
.
commit
()
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assert
True
(
'last-modified'
not
in
response
.
headers
)
self
.
assert
NotIn
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
first_etag
,
response
.
headers
.
get
(
'etag'
))
self
.
assertEqual
(
first_body_fingerprint
,
hashData
(
response
.
body
))
self
.
assertEqual
(
current_activity_count
,
len
(
self
.
portal
.
portal_activities
.
getMessageList
()))
...
...
@@ -121,7 +132,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
response
=
self
.
portal_slap
.
getFullComputerInformation
(
self
.
compute_node_id
)
self
.
commit
()
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assert
True
(
'last-modified'
not
in
response
.
headers
)
self
.
assert
NotIn
(
'last-modified'
,
response
.
headers
)
second_etag
=
self
.
compute_node
.
_calculateRefreshEtag
()
second_body_fingerprint
=
hashData
(
self
.
portal_slap
.
_getSlapComputeNodeXMLFromDict
(
...
...
@@ -143,7 +154,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
response
=
self
.
portal_slap
.
getFullComputerInformation
(
self
.
compute_node_id
)
self
.
commit
()
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assert
True
(
'last-modified'
not
in
response
.
headers
)
self
.
assert
NotIn
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
second_etag
,
response
.
headers
.
get
(
'etag'
))
self
.
assertEqual
(
first_body_fingerprint
,
hashData
(
response
.
body
))
self
.
assertEqual
(
0
,
len
(
self
.
portal
.
portal_activities
.
getMessageList
()))
...
...
@@ -168,7 +179,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
response
=
self
.
portal_slap
.
getFullComputerInformation
(
self
.
compute_node_id
)
self
.
commit
()
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assert
True
(
'last-modified'
not
in
response
.
headers
)
self
.
assert
NotIn
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
second_etag
,
response
.
headers
.
get
(
'etag'
))
self
.
assertEqual
(
first_body_fingerprint
,
hashData
(
response
.
body
))
self
.
assertEqual
(
current_activity_count
,
len
(
self
.
portal
.
portal_activities
.
getMessageList
()))
...
...
@@ -182,7 +193,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
response
=
self
.
portal_slap
.
getFullComputerInformation
(
self
.
compute_node_id
)
self
.
commit
()
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assert
True
(
'last-modified'
not
in
response
.
headers
)
self
.
assert
NotIn
(
'last-modified'
,
response
.
headers
)
third_etag
=
self
.
compute_node
.
_calculateRefreshEtag
()
self
.
assertNotEqual
(
second_etag
,
third_etag
)
self
.
assertEqual
(
third_etag
,
response
.
headers
.
get
(
'etag'
))
...
...
@@ -209,7 +220,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
response
=
self
.
portal_slap
.
getFullComputerInformation
(
self
.
compute_node_id
)
self
.
commit
()
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assert
True
(
'last-modified'
not
in
response
.
headers
)
self
.
assert
NotIn
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
third_etag
,
response
.
headers
.
get
(
'etag'
))
self
.
assertEqual
(
third_body_fingerprint
,
hashData
(
response
.
body
))
self
.
assertEqual
(
current_activity_count
,
len
(
self
.
portal
.
portal_activities
.
getMessageList
()))
...
...
@@ -225,7 +236,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
response
=
self
.
portal_slap
.
getFullComputerInformation
(
self
.
compute_node_id
)
self
.
commit
()
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assert
True
(
'last-modified'
not
in
response
.
headers
)
self
.
assert
NotIn
(
'last-modified'
,
response
.
headers
)
fourth_etag
=
self
.
compute_node
.
_calculateRefreshEtag
()
fourth_body_fingerprint
=
hashData
(
self
.
portal_slap
.
_getSlapComputeNodeXMLFromDict
(
...
...
@@ -258,7 +269,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
False
(
'etag'
in
response
.
headers
)
self
.
assert
NotIn
(
'etag'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
...
...
@@ -618,8 +629,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
start_requested_url
=
self
.
start_requested_software_installation
.
getUrlString
(),
access_status
=
"#error no data found!"
,
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_getComputeNodeInformation
(
self
):
self
.
assertEqual
(
'getFullComputerInformation'
,
...
...
@@ -635,7 +645,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
True
(
'last-modified'
in
response
.
headers
)
self
.
assert
In
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
# check returned XML
...
...
@@ -669,8 +679,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
since
=
since
,
compute_node_id
=
self
.
compute_node_id
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_accessed_getComputerStatus
(
self
):
self
.
login
(
self
.
compute_node_user_id
)
...
...
@@ -684,7 +693,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
True
(
'last-modified'
in
response
.
headers
)
self
.
assert
In
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
...
...
@@ -721,8 +730,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
since
=
since
,
compute_node_id
=
self
.
compute_node_id
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
assertComputeNodeBangSimulator
(
self
,
args
,
kwargs
):
stored
=
eval
(
open
(
self
.
compute_node_bang_simulator
).
read
())
#pylint: disable=eval-used
...
...
@@ -799,7 +807,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
True
(
'last-modified'
in
response
.
headers
)
self
.
assert
In
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
# check returned XML
...
...
@@ -833,8 +841,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
since
=
since
,
reference
=
software_installation
.
getReference
()
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_destroyedSoftwareRelease_noSoftwareInstallation
(
self
):
...
...
@@ -907,8 +914,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
compute_node_id
=
self
.
compute_node_id
,
reference
=
software_installation
.
getReference
()
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_buildingSoftwareRelease
(
self
):
self
.
_makeComplexComputeNode
()
...
...
@@ -957,8 +963,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
compute_node_id
=
self
.
compute_node_id
,
reference
=
software_installation
.
getReference
()
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_softwareReleaseError
(
self
):
self
.
_makeComplexComputeNode
()
...
...
@@ -1007,8 +1012,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
compute_node_id
=
self
.
compute_node_id
,
reference
=
software_installation
.
getReference
()
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_useComputer_wrong_xml
(
self
):
self
.
login
(
self
.
compute_node_user_id
)
...
...
@@ -1126,7 +1130,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
True
(
'last-modified'
in
response
.
headers
)
self
.
assert
In
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
# check returned XML
...
...
@@ -1146,8 +1150,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
instance_certificate
=
self
.
start_requested_software_instance
.
getSslCertificate
(),
instance_key
=
self
.
start_requested_software_instance
.
getSslKey
()
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_getFullComputerInformation
(
self
):
self
.
_makeComplexComputeNode
(
with_slave
=
True
)
...
...
@@ -1158,7 +1161,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
False
(
'etag'
in
response
.
headers
)
self
.
assert
NotIn
(
'etag'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
# check returned XML
...
...
@@ -1288,8 +1291,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
slave_1_title
=
self
.
start_requested_slave_instance
.
getTitle
(),
access_status
=
"#error no data found for %s"
%
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_getComputerPartitionStatus
(
self
):
self
.
_makeComplexComputeNode
()
...
...
@@ -1305,7 +1307,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
True
(
'last-modified'
in
response
.
headers
)
self
.
assert
In
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
# check returned XML
...
...
@@ -1338,8 +1340,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_getComputerPartitionStatus_visited
(
self
):
self
.
_makeComplexComputeNode
()
...
...
@@ -1356,7 +1357,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
True
(
'last-modified'
in
response
.
headers
)
self
.
assert
In
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
# check returned XML
...
...
@@ -1391,8 +1392,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
compute_node_id
=
self
.
compute_node_id
,
partition_id
=
partition_id
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_registerComputerPartition_withSlave
(
self
):
self
.
_makeComplexComputeNode
(
with_slave
=
True
)
...
...
@@ -1405,7 +1405,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
True
(
'last-modified'
in
response
.
headers
)
self
.
assert
In
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
# check returned XML
...
...
@@ -1522,8 +1522,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
slave_1_instance_guid
=
self
.
start_requested_slave_instance
.
getReference
(),
slave_1_title
=
self
.
start_requested_slave_instance
.
getTitle
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_registerComputerPartition
(
self
):
self
.
_makeComplexComputeNode
()
...
...
@@ -1536,7 +1535,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
True
(
'last-modified'
in
response
.
headers
)
self
.
assert
In
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
# check returned XML
...
...
@@ -1634,8 +1633,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
root_instance_title
=
self
.
start_requested_software_instance
.
getSpecialiseValue
().
getTitle
(),
software_type
=
self
.
start_requested_software_instance
.
getSourceReference
()
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
assertInstanceUpdateConnectionSimulator
(
self
,
args
,
kwargs
):
stored
=
eval
(
open
(
self
.
instance_update_connection_simulator
).
read
())
#pylint: disable=eval-used
...
...
@@ -1757,8 +1755,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_softwareInstanceError_twice
(
self
):
self
.
_makeComplexComputeNode
()
...
...
@@ -1805,8 +1802,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
self
.
unpinDateTime
()
time
.
sleep
(
1
)
...
...
@@ -1855,8 +1851,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
assertInstanceBangSimulator
(
self
,
args
,
kwargs
):
stored
=
eval
(
open
(
self
.
instance_bang_simulator
).
read
())
#pylint: disable=eval-used
...
...
@@ -1915,8 +1910,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
self
.
assertInstanceBangSimulator
((),
{
'comment'
:
error_log
,
'bang_tree'
:
True
})
finally
:
if
os
.
path
.
exists
(
self
.
instance_bang_simulator
):
...
...
@@ -2254,8 +2248,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_startedComputePartition
(
self
):
self
.
_makeComplexComputeNode
()
...
...
@@ -2301,8 +2294,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_getSoftwareReleaseListFromSoftwareProduct
(
self
):
new_id
=
self
.
generateNewId
()
...
...
@@ -2344,8 +2336,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</list>
</marshal>
"""
%
(
software_release2
.
getUrlString
(),
software_release1
.
getUrlString
())
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_getSoftwareReleaseListFromSoftwareProduct_effectiveDate
(
self
):
new_id
=
self
.
generateNewId
()
...
...
@@ -2391,8 +2382,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
(
software_release3
.
getUrlString
(),
software_release1
.
getUrlString
(),
software_release2
.
getUrlString
())
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_getSoftwareReleaseListFromSoftwareProduct_emptySoftwareProduct
(
self
):
new_id
=
self
.
generateNewId
()
...
...
@@ -2408,8 +2398,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<list id="i2"/>
</marshal>
"""
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_getSoftwareReleaseListFromSoftwareProduct_NoSoftwareProduct
(
self
):
response
=
self
.
portal_slap
.
getSoftwareReleaseListFromSoftwareProduct
(
...
...
@@ -2422,8 +2411,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<list id="i2"/>
</marshal>
"""
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_getSoftwareReleaseListFromSoftwareProduct_fromUrl
(
self
):
new_id
=
self
.
generateNewId
()
...
...
@@ -2464,8 +2452,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</list>
</marshal>
"""
%
(
software_release2
.
getUrlString
(),
software_release1
.
getUrlString
())
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
class
TestSlapOSSlapToolPersonAccess
(
TestSlapOSSlapToolMixin
):
...
...
@@ -2495,7 +2482,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
True
(
'last-modified'
in
response
.
headers
)
self
.
assert
In
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
# check returned XML
...
...
@@ -2529,8 +2516,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
since
=
since
,
compute_node_id
=
self
.
compute_node_id
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_accessed_getComputerStatus
(
self
):
self
.
login
(
self
.
compute_node_user_id
)
...
...
@@ -2544,7 +2530,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
True
(
'last-modified'
in
response
.
headers
)
self
.
assert
In
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
...
...
@@ -2581,8 +2567,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
since
=
since
,
compute_node_id
=
self
.
compute_node_id
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
assertComputeNodeBangSimulator
(
self
,
args
,
kwargs
):
stored
=
eval
(
open
(
self
.
compute_node_bang_simulator
).
read
())
#pylint: disable=eval-used
...
...
@@ -2625,7 +2610,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
True
(
'last-modified'
in
response
.
headers
)
self
.
assert
In
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
# check returned XML
...
...
@@ -2658,8 +2643,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_getComputerPartitionStatus_visited
(
self
):
self
.
_makeComplexComputeNode
(
person
=
self
.
person
)
...
...
@@ -2678,7 +2662,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
True
(
'last-modified'
in
response
.
headers
)
self
.
assert
In
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
# check returned XML
...
...
@@ -2713,8 +2697,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
compute_node_id
=
self
.
compute_node_id
,
partition_id
=
partition_id
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_registerComputerPartition_withSlave
(
self
):
self
.
_makeComplexComputeNode
(
person
=
self
.
person
,
with_slave
=
True
)
...
...
@@ -2727,7 +2710,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
True
(
'last-modified'
in
response
.
headers
)
self
.
assert
In
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
# check returned XML
...
...
@@ -2844,8 +2827,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
slave_1_instance_guid
=
self
.
start_requested_slave_instance
.
getReference
(),
slave_1_title
=
self
.
start_requested_slave_instance
.
getTitle
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
test_registerComputerPartition
(
self
):
self
.
_makeComplexComputeNode
(
person
=
self
.
person
)
...
...
@@ -2858,7 +2840,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
response
.
headers
.
get
(
'cache-control'
))
self
.
assertEqual
(
'REMOTE_USER'
,
response
.
headers
.
get
(
'vary'
))
self
.
assert
True
(
'last-modified'
in
response
.
headers
)
self
.
assert
In
(
'last-modified'
,
response
.
headers
)
self
.
assertEqual
(
'text/xml; charset=utf-8'
,
response
.
headers
.
get
(
'content-type'
))
# check returned XML
...
...
@@ -2956,8 +2938,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
root_instance_title
=
self
.
start_requested_software_instance
.
getSpecialiseValue
().
getTitle
(),
software_type
=
self
.
start_requested_software_instance
.
getSourceReference
()
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
assertInstanceBangSimulator
(
self
,
args
,
kwargs
):
stored
=
eval
(
open
(
self
.
instance_bang_simulator
).
read
())
#pylint: disable=eval-used
...
...
@@ -3018,8 +2999,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
person_reference
=
self
.
person_reference
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
()
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
self
.
assertInstanceBangSimulator
((),
{
'comment'
:
error_log
,
'bang_tree'
:
True
})
finally
:
if
os
.
path
.
exists
(
self
.
instance_bang_simulator
):
...
...
@@ -3201,9 +3181,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
ip
=
self
.
start_requested_software_instance
.
getAggregateValue
()
\
.
getDefaultNetworkAddressIpAddress
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
def
assertSupplySimulator
(
self
,
args
,
kwargs
):
stored
=
eval
(
open
(
self
.
compute_node_supply_simulator
).
read
())
#pylint: disable=eval-used
...
...
@@ -3269,8 +3247,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
{
'compute_node_id'
:
compute_node_reference
}
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
self
.
assertRequestComputeNodeSimulator
((),
{
'compute_node_title'
:
compute_node_id
})
finally
:
if
os
.
path
.
exists
(
self
.
compute_node_request_compute_node_simulator
):
...
...
@@ -3310,8 +3287,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
{
'compute_node_key'
:
compute_node_key
,
'compute_node_certificate'
:
compute_node_certificate
}
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
self
.
assertXMLEqual
(
expected_xml
,
got_xml
)
self
.
assertGenerateComputeNodeCertificateSimulator
((),
{})
finally
:
if
os
.
path
.
exists
(
self
.
generate_compute_node_certificate_simulator
):
...
...
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapToolComputeNodeUpdateFromDict.py
View file @
ccbf6e16
...
...
@@ -88,7 +88,7 @@ class TestSlapOSCoreComputeNodeUpdateFromDict(SlapOSTestCaseMixinWithAbort):
self
.
assertEqual
(
address
.
getIpAddress
(),
'e'
)
self
.
assertEqual
(
address
.
getNetmask
(),
'f'
)
# Existing document should be edited if possible
self
.
assert
True
(
address
.
getId
()
in
(
'foo'
,
'bar'
))
self
.
assert
In
(
address
.
getId
(),
(
'foo'
,
'bar'
))
#############################################
# Compute Partition network information
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionCondition_renderKVMClusterParameter.py
View file @
ccbf6e16
...
...
@@ -35,6 +35,11 @@ for i in range(amount):
xml_parameter
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="_">%s</parameter>
</instance>"""
%
json
.
dumps
(
json_parameter
,
indent
=
2
)
</instance>"""
%
json
.
dumps
(
json_parameter
,
indent
=
2
,
sort_keys
=
True
,
# BBB PY2 https://github.com/python/cpython/issues/60537#issuecomment-1093598422
separators
=
(
','
,
': '
),
)
return
xml_parameter
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
ccbf6e16
...
...
@@ -966,9 +966,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
"TestSubscriptionSkins Notification Message %s %s"
%
(
subscription_request
.
getLanguage
(),
notification_message
),
mail_message
.
getTitle
())
self
.
assert
True
(
subscription_request
.
getDefaultEmailText
()
in
\
self
.
assert
In
(
subscription_request
.
getDefaultEmailText
(),
\
mail_message
.
getTextContent
())
self
.
assert
True
(
subscription_request
.
getDestinationSectionTitle
()
in
\
self
.
assert
In
(
subscription_request
.
getDestinationSectionTitle
(),
\
mail_message
.
getTextContent
())
def
checkEmailPaymentNotification
(
self
,
subscription_request
,
...
...
@@ -984,9 +984,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
mail_message
.
getTitle
())
invoice
=
subscription_request
.
SubscriptionRequest_verifyPaymentBalanceIsReady
()
self
.
assertEqual
(
invoice
.
getSimulationState
(),
'stopped'
)
self
.
assert
True
(
invoice
.
getRelativeUrl
()
in
\
self
.
assert
In
(
invoice
.
getRelativeUrl
(),
\
mail_message
.
getTextContent
())
self
.
assert
True
(
subscription_request
.
getDestinationSectionTitle
()
in
\
self
.
assert
In
(
subscription_request
.
getDestinationSectionTitle
(),
\
mail_message
.
getTextContent
())
def
checkEmailInstanceNotification
(
self
,
subscription_request
,
...
...
@@ -1002,9 +1002,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
mail_message
.
getTitle
())
instance_tree
=
subscription_request
.
getAggregateValue
()
self
.
assertEqual
(
instance_tree
.
getSlapState
(),
'start_requested'
)
self
.
assert
True
(
instance_tree
.
getRelativeUrl
()
in
\
self
.
assert
In
(
instance_tree
.
getRelativeUrl
(),
\
mail_message
.
getTextContent
())
self
.
assert
True
(
subscription_request
.
getDestinationSectionTitle
()
in
\
self
.
assert
In
(
subscription_request
.
getDestinationSectionTitle
(),
\
mail_message
.
getTextContent
())
def
checkRelatedInstance
(
self
,
subscription_request
):
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionSkins.py
View file @
ccbf6e16
...
...
@@ -122,11 +122,11 @@ class TestSubscriptionCondition_renderKVMClusterParameter(TestSubscriptionSkinsM
"KVM0": {
"cpu-count": 40,
"cpu-max-count": 41,
"ram-size": 245760,
"ram-max-size": 245761,
"disable-ansible-promise": true,
"disk-device-path": "/dev/sdb",
"project-guid": "PROJ-XXXX",
"disable-ansible-promise": true
"ram-max-size": 245761,
"ram-size": 245760
}
}
}</parameter>
...
...
@@ -144,13 +144,13 @@ class TestSubscriptionCondition_renderKVMClusterParameter(TestSubscriptionSkinsM
<parameter id="_">{
"kvm-partition-dict": {
"KVM0": {
"
disable-ansible-promise": true,
"
disk-device-path": "/dev/sdb",
"
cpu-count": 40,
"
ram-max-size": 245761,
"
ram-size": 245760,
"
project-guid": "PROJ-XXXX",
"
cpu-max-count": 41,
"
cpu-count": 40,
"
cpu-max-count": 41,
"
disable-ansible-promise": true,
"
disk-device-path": "/dev/sdb",
"
project-guid": "PROJ-XXXX",
"
ram-max-size": 245761,
"
ram-size": 245760,
"sticky-computer": true
}
}
...
...
@@ -163,23 +163,23 @@ class TestSubscriptionCondition_renderKVMClusterParameter(TestSubscriptionSkinsM
<parameter id="_">{
"kvm-partition-dict": {
"KVM0": {
"
disable-ansible-promise": true,
"
disk-device-path": "/dev/sdb",
"
cpu-count": 40,
"
ram-max-size": 245761,
"
ram-size": 245760,
"
project-guid": "PROJ-XXXX",
"
cpu-max-count": 41,
"
cpu-count": 40,
"
cpu-max-count": 41,
"
disable-ansible-promise": true,
"
disk-device-path": "/dev/sdb",
"
project-guid": "PROJ-XXXX",
"
ram-max-size": 245761,
"
ram-size": 245760,
"sticky-computer": true
},
},
"KVM1": {
"
disk-device-path": "/dev/sdb",
"cpu-
count": 40,
"
ram-max-size": 245761,
"
cpu-max-count": 41,
"
disable-ansible-promise": true,
"ram-
size": 245760,
"
project-guid": "PROJ-XXXX"
"
cpu-count": 40,
"cpu-
max-count": 41,
"
disable-ansible-promise": true,
"
disk-device-path": "/dev/sdb",
"
project-guid": "PROJ-XXXX",
"ram-
max-size": 245761,
"
ram-size": 245760
}
}
}</parameter>
...
...
slapos/tests/test_promise.py
View file @
ccbf6e16
...
...
@@ -664,7 +664,7 @@ class RunPromise(GenericPromise):
def
test_method
(
result
):
self
.
assertTrue
(
isinstance
(
result
,
PromiseQueueResult
))
self
.
assertTrue
(
isinstance
(
result
.
item
,
TestResult
))
self
.
assert
True
(
result
.
name
in
[
promise_failed
,
promise_name
])
self
.
assert
In
(
result
.
name
,
[
promise_failed
,
promise_name
])
if
result
.
name
==
promise_failed
:
self
.
assertEqual
(
result
.
item
.
hasFailed
(),
True
)
self
.
assertEqual
(
result
.
item
.
message
,
"failed"
)
...
...
@@ -705,7 +705,7 @@ class RunPromise(GenericPromise):
def
test_method
(
result
):
self
.
assertTrue
(
isinstance
(
result
,
PromiseQueueResult
))
self
.
assertTrue
(
isinstance
(
result
.
item
,
TestResult
))
self
.
assert
True
(
result
.
name
in
[
first_promise
,
second_promise
,
third_promise
])
self
.
assert
In
(
result
.
name
,
[
first_promise
,
second_promise
,
third_promise
])
self
.
assertEqual
(
result
.
item
.
hasFailed
(),
False
)
self
.
assertEqual
(
result
.
item
.
message
,
"success"
)
self
.
counter
+=
1
...
...
@@ -771,7 +771,7 @@ class RunPromise(GenericPromise):
self
.
counter
=
0
def
test_method_first
(
result
):
self
.
assert
True
(
result
.
name
in
[
first_promise
,
second_promise
])
self
.
assert
In
(
result
.
name
,
[
first_promise
,
second_promise
])
self
.
assertEqual
(
result
.
item
.
hasFailed
(),
False
)
self
.
assertEqual
(
result
.
item
.
message
,
"success"
)
self
.
counter
+=
1
...
...
@@ -809,7 +809,7 @@ class RunPromise(GenericPromise):
self
.
counter
=
0
def
test_method
(
result
):
self
.
assert
True
(
result
.
name
in
[
first_promise
,
second_promise
])
self
.
assert
In
(
result
.
name
,
[
first_promise
,
second_promise
])
self
.
assertEqual
(
result
.
item
.
hasFailed
(),
False
)
self
.
assertEqual
(
result
.
item
.
message
,
"success"
)
self
.
counter
+=
1
...
...
@@ -956,7 +956,7 @@ class RunPromise(GenericPromise):
self
.
counter
=
0
def
test_method
(
result
):
self
.
assert
True
(
result
.
name
in
[
first_promise
,
second_promise
])
self
.
assert
In
(
result
.
name
,
[
first_promise
,
second_promise
])
self
.
assertEqual
(
result
.
item
.
hasFailed
(),
False
)
self
.
assertEqual
(
result
.
item
.
message
,
"success"
)
self
.
counter
+=
1
...
...
@@ -1082,7 +1082,7 @@ exit 0
self
.
counter
=
0
self
.
check_list
=
[
first_promise
,
second_promise
,
third_promise
]
def
test_method
(
result
):
self
.
assert
True
(
result
.
name
in
self
.
check_list
)
self
.
assert
In
(
result
.
name
,
self
.
check_list
)
self
.
assertEqual
(
result
.
item
.
hasFailed
(),
False
)
self
.
assertEqual
(
result
.
item
.
message
,
"success"
)
self
.
counter
+=
1
...
...
@@ -1110,7 +1110,7 @@ exit 0
self
.
counter
=
0
self
.
check_list
=
[
first_promise
,
second_promise
,
third_promise
]
def
test_method
(
result
):
self
.
assert
True
(
result
.
name
in
self
.
check_list
)
self
.
assert
In
(
result
.
name
,
self
.
check_list
)
self
.
assertEqual
(
result
.
item
.
hasFailed
(),
False
)
self
.
assertEqual
(
result
.
item
.
message
,
"success"
)
self
.
counter
+=
1
...
...
@@ -1186,7 +1186,7 @@ exit 0
self
.
assertTrue
(
result
.
execution_time
>=
1
)
self
.
assertEqual
(
result
.
title
,
'my_promise'
)
self
.
assertEqual
(
result
.
name
,
promise_name
)
self
.
assert
True
(
"Promise timed out after"
in
result
.
item
.
message
)
self
.
assert
In
(
"Promise timed out after"
,
result
.
item
.
message
)
self
.
assertEqual
(
result
.
item
.
hasFailed
(),
True
)
self
.
configureLauncher
(
save_method
=
test_method
,
enable_anomaly
=
True
,
timeout
=
1
)
...
...
@@ -1218,7 +1218,7 @@ echo "success"
self
.
assertEqual
(
result
.
title
,
promise_name
)
self
.
assertEqual
(
result
.
name
,
promise_name
)
self
.
assertEqual
(
result
.
path
,
promise_path
)
self
.
assert
True
(
"Promise timed out after"
in
result
.
item
.
message
)
self
.
assert
In
(
"Promise timed out after"
,
result
.
item
.
message
)
self
.
assertEqual
(
result
.
item
.
hasFailed
(),
True
)
self
.
assertTrue
(
isinstance
(
result
.
item
.
date
,
datetime
))
...
...
slapos/tests/test_slapgrid.py
View file @
ccbf6e16
...
...
@@ -2392,7 +2392,7 @@ class TestSlapgridCPWithMasterPromise(MasterMixin, unittest.TestCase):
log_file
=
'%s/.slapgrid/log/instance.log'
%
instance
.
partition_path
with
open
(
log_file
)
as
f
:
self
.
assert
True
(
'Error Promise 254554802'
in
f
.
read
())
self
.
assert
In
(
'Error Promise 254554802'
,
f
.
read
())
self
.
assertTrue
(
instance
.
error
)
self
.
assertIsNone
(
instance
.
state
)
...
...
@@ -3135,7 +3135,7 @@ exit 0
self
.
_wait_prerm_script_finished
(
partition
.
partition_path
)
with
open
(
os
.
path
.
join
(
partition
.
partition_path
,
'.0-prerm_slapos_pre_delete.log'
))
as
f
:
# the script is well finished...
self
.
assert
True
(
"finished prerm script."
in
f
.
read
())
self
.
assert
In
(
"finished prerm script."
,
f
.
read
())
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
# Assert partition directory is empty
...
...
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