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
a2f90846
Commit
a2f90846
authored
Sep 25, 2023
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: test: simplify
parent
e0110082
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
88 deletions
+13
-88
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
+13
-88
No files found.
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
View file @
a2f90846
...
@@ -596,93 +596,23 @@ class TestSlapOSisSupportRequestCreationClosed(TestCRMSkinsMixin):
...
@@ -596,93 +596,23 @@ class TestSlapOSisSupportRequestCreationClosed(TestCRMSkinsMixin):
class
TestSlapOSHasError
(
SlapOSTestCaseMixin
):
class
TestSlapOSHasError
(
SlapOSTestCaseMixin
):
def
makeSoftwareRelease
(
self
,
software_release_url
=
None
):
software_release
=
self
.
portal
.
software_release_module
\
.
template_software_release
.
Base_createCloneDocument
(
batch_mode
=
1
)
new_id
=
self
.
generateNewId
()
software_release
.
edit
(
url_string
=
software_release_url
or
self
.
generateNewSoftwareReleaseUrl
(),
reference
=
'TESTSOFTRELS-%s'
%
new_id
,
title
=
'Start requested for %s'
%
new_id
)
software_release
.
release
()
return
software_release
def
_makeSoftwareInstallation
(
self
,
software_release_url
):
software_installation
=
self
.
portal
\
.
software_installation_module
.
template_software_installation
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
new_id
=
self
.
generateNewId
()
software_installation
.
edit
(
url_string
=
software_release_url
,
aggregate
=
self
.
compute_node
.
getRelativeUrl
(),
reference
=
'TESTSOFTINSTS-%s'
%
new_id
,
title
=
'Start requested for %s'
%
self
.
compute_node
.
getUid
()
)
software_installation
.
validate
()
software_installation
.
requestStart
()
return
software_installation
def
_makeSoftwareInstance
(
self
,
instance_tree
,
software_url
):
kw
=
dict
(
software_release
=
software_url
,
software_type
=
self
.
generateNewSoftwareType
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
instance_tree
.
getTitle
(),
state
=
'started'
)
instance_tree
.
requestStart
(
**
kw
)
instance_tree
.
requestInstance
(
**
kw
)
def
_makeInstanceTree
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
instance_tree
=
self
.
portal
\
.
instance_tree_module
.
template_instance_tree
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
instance_tree
.
validate
()
new_id
=
self
.
generateNewId
()
instance_tree
.
edit
(
title
=
"Test hosting sub ticket %s"
%
new_id
,
reference
=
"TESTHST-%s"
%
new_id
,
destination_section_value
=
person
)
return
instance_tree
def
_makeComputePartitionList
(
self
):
for
i
in
range
(
1
,
5
):
id_
=
'partition%s'
%
(
i
,
)
p
=
self
.
compute_node
.
newContent
(
portal_type
=
'Compute Partition'
,
id
=
id_
,
title
=
id_
,
reference
=
id_
,
default_network_address_ip_address
=
'ip_address_%s'
%
i
,
default_network_address_netmask
=
'netmask_%s'
%
i
)
p
.
markFree
()
p
.
validate
()
def
test_SoftwareInstance_hasReportedError
(
self
):
def
test_SoftwareInstance_hasReportedError
(
self
):
instance_tree
=
self
.
_makeInstanceTree
()
instance
=
self
.
portal
.
software_instance_module
.
newContent
(
self
.
_makeSoftwareInstance
(
instance_tree
,
portal_type
=
"Software Instance"
,
self
.
generateNewSoftwareReleaseUrl
())
reference
=
self
.
generateNewId
()
instance
=
instance_tree
.
getSuccessorValue
()
)
_
,
partition
=
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComputeNode
(
self
.
project
)
self
.
_makeComputePartitionList
()
error_date
=
DateTime
()
try
:
self
.
pinDateTime
(
error_date
)
instance
.
setErrorStatus
(
""
)
instance
.
setErrorStatus
(
""
)
finally
:
self
.
unpinDateTime
()
self
.
assertEqual
(
instance
.
SoftwareInstance_hasReportedError
(),
None
)
self
.
assertEqual
(
instance
.
SoftwareInstance_hasReportedError
(),
None
)
instance
.
setAggregateValue
(
self
.
compute_node
.
partition1
)
instance
.
setAggregateValue
(
partition
)
self
.
assertEqual
(
str
(
instance
.
SoftwareInstance_hasReportedError
()),
'#error '
)
self
.
assertEqual
(
str
(
instance
.
SoftwareInstance_hasReportedError
()),
'#error '
)
...
@@ -690,11 +620,7 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
...
@@ -690,11 +620,7 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
self
.
assertEqual
(
instance
.
SoftwareInstance_hasReportedError
(),
None
)
self
.
assertEqual
(
instance
.
SoftwareInstance_hasReportedError
(),
None
)
def
test_SoftwareInstallation_hasReportedError
(
self
):
def
test_SoftwareInstallation_hasReportedError
(
self
):
software_release
=
self
.
makeSoftwareRelease
()
installation
=
self
.
portal
.
software_installation_module
.
newContent
()
self
.
_makeComputeNode
(
self
.
project
)
installation
=
self
.
_makeSoftwareInstallation
(
software_release
.
getUrlString
()
)
self
.
assertEqual
(
installation
.
SoftwareInstallation_hasReportedError
(),
None
)
self
.
assertEqual
(
installation
.
SoftwareInstallation_hasReportedError
(),
None
)
...
@@ -713,7 +639,6 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
...
@@ -713,7 +639,6 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
self
.
assertEqual
(
installation
.
SoftwareInstallation_hasReportedError
(),
None
)
self
.
assertEqual
(
installation
.
SoftwareInstallation_hasReportedError
(),
None
)
class
TestCRMPropertySheetConstraint
(
SlapOSTestCaseMixin
):
class
TestCRMPropertySheetConstraint
(
SlapOSTestCaseMixin
):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
...
...
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