Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Rafael Monnerat
slapos.core
Commits
31c04abe
Commit
31c04abe
authored
Jan 14, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio: Fixup Tests
parent
eabd7e10
Pipeline
#19299
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
75 deletions
+99
-75
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
...ortal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
+99
-75
No files found.
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
View file @
31c04abe
...
...
@@ -38,9 +38,17 @@ class TestSlapOSHalJsonStyleMixin(SlapOSTestCaseMixinWithAbort):
maxDiff
=
None
def
afterSetUp
(
self
):
SlapOSTestCaseMixinWithAbort
.
afterSetUp
(
self
)
self
.
created_at
=
rfc1123_date
(
DateTime
())
d
=
DateTime
()
self
.
pinDateTime
(
d
)
self
.
created_at
=
rfc1123_date
(
d
)
self
.
changeSkin
(
'Hal'
)
def
beforeTearDown
(
self
):
SlapOSTestCaseMixinWithAbort
.
beforeTearDown
(
self
)
self
.
unpinDateTime
()
def
_logFakeAccess
(
self
,
reference
,
text
=
"#access OK"
,
state
=
'start_requested'
):
value
=
json
.
dumps
({
'user'
:
'SlapOS Master'
,
...
...
@@ -71,8 +79,8 @@ class TestSlapOSHalJsonStyleMixin(SlapOSTestCaseMixinWithAbort):
.
template_software_instance
.
Base_createCloneDocument
(
batch_mode
=
1
)
instance
.
edit
(
reference
=
"TESTSOFTINST-%s"
%
instance
.
getId
())
instance
.
validate
()
self
.
changeSkin
(
'Hal'
)
self
.
tic
()
self
.
changeSkin
(
'Hal'
)
return
instance
def
_makeSlaveInstance
(
self
):
...
...
@@ -80,6 +88,7 @@ class TestSlapOSHalJsonStyleMixin(SlapOSTestCaseMixinWithAbort):
.
template_slave_instance
.
Base_createCloneDocument
(
batch_mode
=
1
)
instance
.
validate
()
self
.
tic
()
self
.
changeSkin
(
'Hal'
)
return
instance
def
_makeComputeNode
(
self
,
owner
=
None
,
allocation_scope
=
'open/public'
):
...
...
@@ -179,7 +188,10 @@ class TestInstanceTree_getNewsDict(TestSlapOSHalJsonStyleMixin):
self
.
tic
()
self
.
changeSkin
(
'Hal'
)
news_dict
=
instance_tree
.
InstanceTree_getNewsDict
()
expected_news_dict
=
{
'instance'
:
[{
'no_data'
:
1
,
expected_news_dict
=
{
'instance'
:
[{
'created_at'
:
self
.
created_at
,
'no_data'
:
1
,
'since'
:
self
.
created_at
,
'state'
:
''
,
'text'
:
'#error no data found for %s'
%
instance
.
getReference
(),
'user'
:
'SlapOS Master'
}]}
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
...
...
@@ -208,12 +220,18 @@ class TestInstanceTree_getNewsDict(TestSlapOSHalJsonStyleMixin):
self
.
tic
()
self
.
changeSkin
(
'Hal'
)
news_dict
=
instance_tree
.
InstanceTree_getNewsDict
()
expected_news_dict
=
{
'instance'
:
[{
'no_data'
:
1
,
expected_news_dict
=
{
'instance'
:
[{
'created_at'
:
self
.
created_at
,
'no_data'
:
1
,
'since'
:
self
.
created_at
,
'state'
:
''
,
'text'
:
'#error no data found for %s'
%
instance0
.
getReference
(),
'user'
:
'SlapOS Master'
},
{
'no_data'
:
1
,
'text'
:
'#error no data found for %s'
%
instance
.
getReference
(),
'user'
:
'SlapOS Master'
}]}
{
'created_at'
:
self
.
created_at
,
'no_data'
:
1
,
'since'
:
self
.
created_at
,
'state'
:
''
,
'text'
:
'#error no data found for %s'
%
instance
.
getReference
(),
'user'
:
'SlapOS Master'
}]}
self
.
assertEqual
(
news_dict
[
"instance"
],
expected_news_dict
[
"instance"
])
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
...
...
@@ -224,13 +242,13 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
instance
=
self
.
_makeInstance
()
self
.
_logFakeAccess
(
instance
.
getReference
())
news_dict
=
instance
.
SoftwareInstance_getNewsDict
()
expected_news_dict
=
{
u
'created_at'
:
self
.
created_at
,
expected_news_dict
=
{
'created_at'
:
self
.
created_at
,
'no_data_since_15_minutes'
:
0
,
'no_data_since_5_minutes'
:
0
,
'since'
:
self
.
created_at
,
'state'
:
'start_requested'
,
'text'
:
u
'#access OK'
,
u'user'
:
u
'SlapOS Master'
}
'text'
:
'#access OK'
,
'user'
:
'SlapOS Master'
}
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
...
...
@@ -238,6 +256,8 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
def
test_no_data
(
self
):
instance
=
self
.
_makeInstance
()
self
.
changeSkin
(
'Hal'
)
news_dict
=
instance
.
SoftwareInstance_getNewsDict
()
expected_news_dict
=
{
'created_at'
:
self
.
created_at
,
'no_data'
:
1
,
...
...
@@ -291,13 +311,13 @@ class TestSoftwareInstallation_getNewsDict(TestSlapOSHalJsonStyleMixin):
installation
=
self
.
_makeSoftwareInstallation
()
self
.
_logFakeAccess
(
installation
.
getReference
())
news_dict
=
installation
.
SoftwareInstallation_getNewsDict
()
expected_news_dict
=
{
u
'created_at'
:
self
.
created_at
,
expected_news_dict
=
{
'created_at'
:
self
.
created_at
,
'no_data_since_15_minutes'
:
0
,
'no_data_since_5_minutes'
:
0
,
'since'
:
self
.
created_at
,
'state'
:
'start_requested'
,
'text'
:
u
'#access OK'
,
u'user'
:
u
'SlapOS Master'
}
'text'
:
'#access OK'
,
'user'
:
'SlapOS Master'
}
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
...
...
@@ -309,13 +329,13 @@ class TestSoftwareInstallation_getNewsDict(TestSlapOSHalJsonStyleMixin):
news_dict
=
installation
.
SoftwareInstallation_getNewsDict
()
installation
.
getSlapState
=
fakeStopRequestedSlapState
expected_news_dict
=
{
u
'created_at'
:
self
.
created_at
,
expected_news_dict
=
{
'created_at'
:
self
.
created_at
,
'no_data_since_15_minutes'
:
0
,
'no_data_since_5_minutes'
:
0
,
'since'
:
self
.
created_at
,
'state'
:
'stop_requested'
,
'text'
:
u
'#access OK'
,
u'user'
:
u
'SlapOS Master'
}
'text'
:
'#access OK'
,
'user'
:
'SlapOS Master'
}
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
...
...
@@ -327,13 +347,13 @@ class TestSoftwareInstallation_getNewsDict(TestSlapOSHalJsonStyleMixin):
news_dict
=
installation
.
SoftwareInstallation_getNewsDict
()
installation
.
getSlapState
=
fakeDestroyRequestedSlapState
expected_news_dict
=
{
u
'created_at'
:
self
.
created_at
,
expected_news_dict
=
{
'created_at'
:
self
.
created_at
,
'no_data_since_15_minutes'
:
0
,
'no_data_since_5_minutes'
:
0
,
'since'
:
self
.
created_at
,
'state'
:
'destroy_requested'
,
'text'
:
u
'#access OK'
,
u'user'
:
u
'SlapOS Master'
}
'text'
:
'#access OK'
,
'user'
:
'SlapOS Master'
}
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
...
...
@@ -358,13 +378,13 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
self
.
_logFakeAccess
(
compute_node
.
getReference
())
news_dict
=
compute_node
.
ComputeNode_getNewsDict
()
expected_news_dict
=
{
'compute_node'
:
{
u
'created_at'
:
self
.
created_at
,
{
'created_at'
:
self
.
created_at
,
'no_data_since_15_minutes'
:
0
,
'no_data_since_5_minutes'
:
0
,
'since'
:
self
.
created_at
,
'state'
:
'start_requested'
,
'text'
:
u
'#access OK'
,
u'user'
:
u
'SlapOS Master'
},
'text'
:
'#access OK'
,
'user'
:
'SlapOS Master'
},
'partition'
:
{}
}
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
...
...
@@ -405,8 +425,8 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
'no_data_since_5_minutes'
:
0
,
'since'
:
self
.
created_at
,
'state'
:
'destroy_requested'
,
'text'
:
u
'#access OK'
,
'user'
:
u
'SlapOS Master'
},
'text'
:
'#access OK'
,
'user'
:
'SlapOS Master'
},
'partition'
:
{}
}
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
...
...
@@ -438,14 +458,17 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
self
.
_logFakeAccess
(
compute_node
.
getReference
())
news_dict
=
compute_node
.
ComputeNode_getNewsDict
()
expected_news_dict
=
{
'compute_node'
:
{
'created_at'
:
self
.
created_at
,
{
u'created_at'
:
u'%s'
%
self
.
created_at
,
'no_data_since_15_minutes'
:
0
,
'no_data_since_5_minutes'
:
0
,
'since'
:
self
.
created_at
,
'state'
:
'start_requested'
,
'text'
:
'#access OK'
,
'user'
:
'SlapOS Master'
},
'partition'
:
{
'slappart0'
:
{
'no_data'
:
1
,
u'since'
:
u'%s'
%
self
.
created_at
,
u'state'
:
u'start_requested'
,
u'text'
:
u'#access OK'
,
u'user'
:
u'SlapOS Master'
},
'partition'
:
{
'slappart0'
:
{
'created_at'
:
self
.
created_at
,
'no_data'
:
1
,
'since'
:
self
.
created_at
,
'state'
:
''
,
'text'
:
'#error no data found for %s'
%
(
instance
.
getReference
()),
'user'
:
'SlapOS Master'
}}
}
...
...
@@ -467,22 +490,25 @@ class TestComputerNetwork_getNewsDict(TestSlapOSHalJsonStyleMixin):
news_dict
=
network
.
ComputerNetwork_getNewsDict
()
expected_news_dict
=
{
'compute_node'
:
{
compute_node
.
getReference
():
{
'created_at'
:
self
.
created_at
,
{
u'created_at'
:
u'%s'
%
self
.
created_at
,
'no_data_since_15_minutes'
:
0
,
'no_data_since_5_minutes'
:
0
,
'since'
:
self
.
created_at
,
'state'
:
'start_requested'
,
'text'
:
'#access OK'
,
'user'
:
'SlapOS Master'
}
},
'partition'
:
{
compute_node
.
getReference
():
{
'slappart0'
:
{
'no_data'
:
1
,
'text'
:
'#error no data found for %s'
%
(
instance
.
getReference
()),
'user'
:
'SlapOS Master'
}
u'since'
:
u'%s'
%
self
.
created_at
,
u'state'
:
u'start_requested'
,
u'text'
:
u'#access OK'
,
u'user'
:
u'SlapOS Master'
}},
'partition'
:
{
compute_node
.
getReference
():
{
'slappart0'
:
{
'created_at'
:
self
.
created_at
,
'no_data'
:
1
,
'since'
:
self
.
created_at
,
'state'
:
''
,
'text'
:
'#error no data found for %s'
%
(
instance
.
getReference
()),
'user'
:
'SlapOS Master'
}
}
}
}
}
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
...
...
@@ -513,22 +539,25 @@ class TestOrganisation_getNewsDict(TestSlapOSHalJsonStyleMixin):
news_dict
=
organisation
.
Organisation_getNewsDict
()
expected_news_dict
=
{
'compute_node'
:
{
compute_node
.
getReference
():
{
'created_at'
:
self
.
created_at
,
{
u'created_at'
:
u'%s'
%
self
.
created_at
,
'no_data_since_15_minutes'
:
0
,
'no_data_since_5_minutes'
:
0
,
'since'
:
self
.
created_at
,
'state'
:
'start_requested'
,
'text'
:
'#access OK'
,
'user'
:
'SlapOS Master'
}
},
'partition'
:
{
compute_node
.
getReference
():
{
'slappart0'
:
{
'no_data'
:
1
,
'text'
:
'#error no data found for %s'
%
(
instance
.
getReference
()),
'user'
:
'SlapOS Master'
}
u'since'
:
u'%s'
%
self
.
created_at
,
u'state'
:
u'start_requested'
,
u'text'
:
u'#access OK'
,
u'user'
:
u'SlapOS Master'
}},
'partition'
:
{
compute_node
.
getReference
():
{
'slappart0'
:
{
'created_at'
:
self
.
created_at
,
'no_data'
:
1
,
'since'
:
self
.
created_at
,
'state'
:
''
,
'text'
:
'#error no data found for %s'
%
(
instance
.
getReference
()),
'user'
:
'SlapOS Master'
}
}
}
}
}
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
...
...
@@ -558,22 +587,25 @@ class TestProject_getNewsDict(TestSlapOSHalJsonStyleMixin):
news_dict
=
project
.
Project_getNewsDict
()
expected_news_dict
=
{
'compute_node'
:
{
compute_node
.
getReference
():
{
'created_at'
:
self
.
created_at
,
{
u'created_at'
:
u'%s'
%
self
.
created_at
,
'no_data_since_15_minutes'
:
0
,
'no_data_since_5_minutes'
:
0
,
'since'
:
self
.
created_at
,
'state'
:
'start_requested'
,
'text'
:
'#access OK'
,
'user'
:
'SlapOS Master'
}
},
'partition'
:
{
compute_node
.
getReference
():
{
'slappart0'
:
{
'no_data'
:
1
,
'text'
:
'#error no data found for %s'
%
(
instance
.
getReference
()),
'user'
:
'SlapOS Master'
}
u'since'
:
u'%s'
%
self
.
created_at
,
u'state'
:
u'start_requested'
,
u'text'
:
u'#access OK'
,
u'user'
:
u'SlapOS Master'
}},
'partition'
:
{
compute_node
.
getReference
():
{
'slappart0'
:
{
'created_at'
:
self
.
created_at
,
'no_data'
:
1
,
'since'
:
self
.
created_at
,
'state'
:
''
,
'text'
:
'#error no data found for %s'
%
(
instance
.
getReference
()),
'user'
:
'SlapOS Master'
}
}
}
}
}
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
...
...
@@ -1166,12 +1198,4 @@ class TestInstanceTree_edit(TestSlapOSHalJsonStyleMixin):
self
.
instance_tree
.
getTextContent
())
self
.
assertEqual
(
new_parameter
,
self
.
instance_tree
.
getTextContent
())
self
.
instance_tree
.
getTextContent
())
\ No newline at end of file
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