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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos.core
Commits
926841f6
Commit
926841f6
authored
Mar 09, 2024
by
Jérome Perrin
Committed by
Rafael Monnerat
Mar 22, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: use assertIn(a, b) instead of assertTrue(a in b)
same as
erp5@2e366054
parent
6b081951
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
352 additions
and
352 deletions
+352
-352
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/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
...omponents/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
+1
-1
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_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
+24
-24
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapToolComputeNodeUpdateFromDict.py
.../test.erp5.testSlapOSSlapToolComputeNodeUpdateFromDict.py
+1
-1
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
...al_components/test.erp5.testSlapOSSubscriptionScenario.py
+6
-6
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 @
926841f6
...
...
@@ -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 @
926841f6
...
...
@@ -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 @
926841f6
...
...
@@ -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/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
View file @
926841f6
...
...
@@ -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.testSlapOSCloudAlarm.py
View file @
926841f6
...
...
@@ -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 @
926841f6
...
...
@@ -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 @
926841f6
...
...
@@ -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 @
926841f6
...
...
@@ -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 @
926841f6
...
...
@@ -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 @
926841f6
...
...
@@ -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 @
926841f6
...
...
@@ -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_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm.py
View file @
926841f6
...
...
@@ -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 @
926841f6
...
...
@@ -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 @
926841f6
...
...
@@ -103,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
()))
...
...
@@ -119,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
()))
...
...
@@ -132,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
(
...
...
@@ -154,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
()))
...
...
@@ -179,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
()))
...
...
@@ -193,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'
))
...
...
@@ -220,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
()))
...
...
@@ -236,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
(
...
...
@@ -269,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'
))
...
...
@@ -645,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
...
...
@@ -693,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'
))
...
...
@@ -807,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
...
...
@@ -1130,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
...
...
@@ -1161,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
...
...
@@ -1307,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
...
...
@@ -1357,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
...
...
@@ -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
...
...
@@ -1535,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
...
...
@@ -2482,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
...
...
@@ -2530,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'
))
...
...
@@ -2610,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
...
...
@@ -2662,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
...
...
@@ -2710,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
...
...
@@ -2840,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
...
...
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapToolComputeNodeUpdateFromDict.py
View file @
926841f6
...
...
@@ -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/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
926841f6
...
...
@@ -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
):
...
...
slapos/tests/test_promise.py
View file @
926841f6
...
...
@@ -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 @
926841f6
...
...
@@ -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