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
534272e2
Commit
534272e2
authored
Dec 17, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_json_rpc_api: tests
parent
515bb9c3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
20 deletions
+13
-20
master/bt5/slapos_json_rpc_api/SkinTemplateItem/portal_skins/slapos_jio_api/SoftwareInstanceCertificateRecord_getSoftwareInstanceCertificatesAsJSON.py
...ertificateRecord_getSoftwareInstanceCertificatesAsJSON.py
+6
-5
master/bt5/slapos_json_rpc_api/TestTemplateItem/portal_components/test.erp5.testSlapOSJsonRpc.py
...lateItem/portal_components/test.erp5.testSlapOSJsonRpc.py
+7
-15
No files found.
master/bt5/slapos_json_rpc_api/SkinTemplateItem/portal_skins/slapos_jio_api/SoftwareInstanceCertificateRecord_getSoftwareInstanceCertificatesAsJSON.py
View file @
534272e2
import
json
software_instance
=
context
.
jIOWebSection_getObjectFromData
(
data_dict
)
software_instance
=
context
.
getParentValue
()
return
json
.
dumps
({
# software_instance = context.getParentValue()
"$schema"
:
json_form
.
absolute_url
().
strip
()
+
"/getOutputJSONSchema"
,
return
{
#"$schema": json_form.absolute_url().strip() + "/getOutputJSONSchema",
"reference"
:
software_instance
.
getReference
(),
"reference"
:
software_instance
.
getReference
(),
"key"
:
software_instance
.
getSslKey
(),
"key"
:
software_instance
.
getSslKey
(),
"certificate"
:
software_instance
.
getSslCertificate
(),
"certificate"
:
software_instance
.
getSslCertificate
(),
"portal_type"
:
"Software Instance Certificate Record"
,
"portal_type"
:
"Software Instance Certificate Record"
,
}
,
indent
=
2
)
}
master/bt5/slapos_json_rpc_api/TestTemplateItem/portal_components/test.erp5.testSlapOSJsonRpc.py
View file @
534272e2
...
@@ -171,11 +171,10 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJsonRpcMixin):
...
@@ -171,11 +171,10 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJsonRpcMixin):
instance_2
=
self
.
compute_node
.
partition2
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
instance_2
=
self
.
compute_node
.
partition2
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
instance_3
=
self
.
compute_node
.
partition3
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
instance_3
=
self
.
compute_node
.
partition3
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
self
.
login
(
self
.
compute_node_user_id
)
response
=
self
.
callJsonRpcWebService
(
'slapos.allDocs.slapos_jio_api_search_instance'
,
{
response
=
self
.
callJsonRpcWebService
(
'slapos.allDocs.slapos_jio_api_search_instance'
,
{
"compute_node_id"
:
self
.
compute_node_id
,
"compute_node_id"
:
self
.
compute_node_id
,
"portal_type"
:
"Software Instance"
,
"portal_type"
:
"Software Instance"
,
})
}
,
self
.
compute_node_user_id
)
instance_list_response
=
json
.
loads
(
response
.
getBody
())
instance_list_response
=
json
.
loads
(
response
.
getBody
())
if
200
!=
response
.
getStatus
():
if
200
!=
response
.
getStatus
():
...
@@ -221,7 +220,6 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJsonRpcMixin):
...
@@ -221,7 +220,6 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJsonRpcMixin):
self
.
assertEqual
(
'application/json'
,
self
.
assertEqual
(
'application/json'
,
response
.
headers
.
get
(
'content-type'
))
response
.
headers
.
get
(
'content-type'
))
# Check Data is correct
# Check Data is correct
self
.
login
()
partition
=
instance
.
getAggregateValue
(
portal_type
=
"Compute Partition"
)
partition
=
instance
.
getAggregateValue
(
portal_type
=
"Compute Partition"
)
self
.
assertEqual
({
self
.
assertEqual
({
"$schema"
:
instance
.
getJSONSchemaUrl
(),
"$schema"
:
instance
.
getJSONSchemaUrl
(),
...
@@ -571,25 +569,19 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJsonRpcMixin):
...
@@ -571,25 +569,19 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJsonRpcMixin):
def
test_InstanceAccess_10_getComputerPartitionCertificate
(
self
):
def
test_InstanceAccess_10_getComputerPartitionCertificate
(
self
):
self
.
_makeComplexComputeNode
(
self
.
project
)
self
.
_makeComplexComputeNode
(
self
.
project
)
self
.
login
(
self
.
start_requested_software_instance
.
getUserId
())
response
=
self
.
callJsonRpcWebService
(
"slapos.get.slapos_jio_api_get_software_instance_certificate"
,
{
response
=
self
.
callJsonRpcWebService
(
"slapos.get.slapos_jio_api_get_software_instance_certificate"
,
{
"portal_type"
:
"Software Instance Certificate Record"
,
"portal_type"
:
"Software Instance Certificate Record"
,
"reference"
:
self
.
start_requested_software_instance
.
getReference
(),
"reference"
:
self
.
start_requested_software_instance
.
getReference
(),
})
},
self
.
start_requested_software_instance
.
getUserId
())
certificate_dict
=
json
.
loads
(
response
.
getBody
())
if
200
!=
response
.
getStatus
():
self
.
assertEqual
(
'application/json'
,
response
.
headers
.
get
(
'content-type'
))
raise
ValueError
(
"Unexpected Result %s"
%
certificate_dict
)
self
.
assertEqual
({
self
.
assertEqual
(
'application/json'
,
response
.
headers
.
get
(
'content-type'
))
self
.
assertTrue
(
certificate_dict
.
pop
(
"$schema"
).
endswith
(
"SoftwareInstanceCertificateRecord_getFromJSON/getOutputJSONSchema"
)
)
self
.
assertEqual
(
certificate_dict
,
{
"key"
:
self
.
start_requested_software_instance
.
getSslKey
(),
"key"
:
self
.
start_requested_software_instance
.
getSslKey
(),
"certificate"
:
self
.
start_requested_software_instance
.
getSslCertificate
(),
"certificate"
:
self
.
start_requested_software_instance
.
getSslCertificate
(),
"portal_type"
:
"Software Instance Certificate Record"
,
"portal_type"
:
"Software Instance Certificate Record"
,
"reference"
:
self
.
start_requested_software_instance
.
getReference
(),
"reference"
:
self
.
start_requested_software_instance
.
getReference
(),
})
},
byteify
(
json
.
loads
(
response
.
getBody
())))
self
.
assertEqual
(
response
.
getStatus
(),
200
)
def
test_InstanceAccess_11_getFullComputerInformationWithSharedInstance
(
self
,
with_slave
=
True
):
def
test_InstanceAccess_11_getFullComputerInformationWithSharedInstance
(
self
,
with_slave
=
True
):
self
.
_makeComplexComputeNode
(
self
.
project
,
with_slave
=
with_slave
)
self
.
_makeComplexComputeNode
(
self
.
project
,
with_slave
=
with_slave
)
...
...
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