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
21765702
Commit
21765702
authored
Dec 05, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_json_rpc_api: try a first entry point
parent
dd4b8b3e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
235 additions
and
4 deletions
+235
-4
master/bt5/slapos_json_rpc_api/PathTemplateItem/portal_web_services/slapos_master_api.xml
...athTemplateItem/portal_web_services/slapos_master_api.xml
+218
-0
master/bt5/slapos_json_rpc_api/TestTemplateItem/portal_components/test.erp5.testSlapOSJsonRpc.py
...lateItem/portal_components/test.erp5.testSlapOSJsonRpc.py
+17
-4
No files found.
master/bt5/slapos_json_rpc_api/PathTemplateItem/portal_web_services/slapos_master_api.xml
View file @
21765702
...
@@ -6,10 +6,228 @@
...
@@ -6,10 +6,228 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_Access_contents_information_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Add_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Modify_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_View_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_master_api
</string>
</value>
<value>
<string>
slapos_master_api
</string>
</value>
</item>
</item>
<item>
<key>
<string>
json_form
</string>
</key>
<value>
<tuple>
<string>
slapos.allDocs.slapos_jio_api_search_instance | jIOWebSection_searchInstanceFromJSON
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
edit_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
edit
</string>
</value>
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<unicode>
zope
</unicode>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
error_message
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1021.9504.6788.21009
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
<value>
<string>
current
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</tuple>
<state>
<tuple>
<float>
1733395531.76
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<unicode>
zope
</unicode>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
error_message
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</tuple>
<state>
<tuple>
<float>
1733393628.5
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
...
...
master/bt5/slapos_json_rpc_api/TestTemplateItem/portal_components/test.erp5.testSlapOSJsonRpc.py
View file @
21765702
...
@@ -34,6 +34,7 @@ import urllib
...
@@ -34,6 +34,7 @@ import urllib
import
hashlib
import
hashlib
import
json
import
json
import
io
from
binascii
import
hexlify
from
binascii
import
hexlify
from
OFS.Traversable
import
NotFound
from
OFS.Traversable
import
NotFound
...
@@ -122,11 +123,22 @@ class TestSlapOSJsonRpcMixin(SlapOSTestCaseMixin):
...
@@ -122,11 +123,22 @@ class TestSlapOSJsonRpcMixin(SlapOSTestCaseMixin):
self
.
portal
.
REQUEST
.
set
(
"BODY"
,
json
.
dumps
(
data_dict
))
self
.
portal
.
REQUEST
.
set
(
"BODY"
,
json
.
dumps
(
data_dict
))
return
json_loads_byteified
(
self
.
connector
.
post
())
return
json_loads_byteified
(
self
.
connector
.
post
())
def
allDocsToApi
(
self
,
data_dict
):
def
allDocsToApi2
(
self
,
entry_point
,
data_dict
):
"""
self.portal.REQUEST.set("live_test", True)
self.portal.REQUEST.set("live_test", True)
self.portal.REQUEST.set("BODY", json.dumps(data_dict))
self.portal.REQUEST.set("BODY", json.dumps(data_dict))
self.portal.REQUEST.set("REQUEST_METHOD", "POST")
self.portal.REQUEST.set("REQUEST_METHOD", "POST")
return
json_loads_byteified
(
self
.
connector
.
allDocs
())
return json_loads_byteified(self.connector.allDocs())"""
response
=
self
.
publish
(
self
.
connector
.
getPath
()
+
'/'
+
entry_point
,
user
=
'ERP5TypeTestCase'
,
request_method
=
'POST'
,
stdin
=
io
.
BytesIO
(
json
.
dumps
(
data_dict
)),
env
=
{
'CONTENT_TYPE'
:
'application/json'
})
return
response
def
allDocsToApi
(
self
,
data_dict
):
return
self
.
allDocsToApi2
(
'nope'
,
data_dict
)
def
callUpdateRevision
(
self
):
def
callUpdateRevision
(
self
):
self
.
portal
.
portal_alarms
.
slapos_update_jio_api_revision_template
.
activeSense
()
self
.
portal
.
portal_alarms
.
slapos_update_jio_api_revision_template
.
activeSense
()
...
@@ -181,11 +193,12 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJsonRpcMixin):
...
@@ -181,11 +193,12 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJsonRpcMixin):
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
)
self
.
login
(
self
.
compute_node_user_id
)
instance_list_response
=
self
.
allDocsToApi
(
{
response
=
self
.
allDocsToApi2
(
'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"
,
})
})
response
=
self
.
portal
.
REQUEST
.
RESPONSE
instance_list_response
=
json
.
loads
(
response
.
getBody
())
if
200
!=
response
.
getStatus
():
if
200
!=
response
.
getStatus
():
raise
ValueError
(
"Unexpected Result %s"
%
instance_list_response
)
raise
ValueError
(
"Unexpected Result %s"
%
instance_list_response
)
self
.
assertEqual
(
'application/json'
,
self
.
assertEqual
(
'application/json'
,
...
...
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