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
62f3c917
Commit
62f3c917
authored
Dec 11, 2024
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_json_rpc_api: return a default success content
parent
4a5509ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
master/bt5/erp5_json_rpc_api/DocumentTemplateItem/portal_components/document.erp5.JsonRpcAPIService.py
...Item/portal_components/document.erp5.JsonRpcAPIService.py
+6
-2
master/bt5/erp5_json_rpc_api/TestTemplateItem/portal_components/test.erp5.testJsonRpcAPIService.py
...Item/portal_components/test.erp5.testJsonRpcAPIService.py
+15
-3
No files found.
master/bt5/erp5_json_rpc_api/DocumentTemplateItem/portal_components/document.erp5.JsonRpcAPIService.py
View file @
62f3c917
...
...
@@ -353,7 +353,11 @@ class JsonRpcAPIService(OpenAPIService):
raise
JsonRpcAPIInvalidJsonDictContent
(
str
(
e
))
response
=
request
.
RESPONSE
# XXX Hardcoded JSONForm behaviour
if
result
==
"Nothing to do"
:
result
=
{}
if
(
result
==
"Nothing to do"
)
or
(
not
result
):
result
=
{
'status'
:
200
,
'type'
:
'success-type'
,
'title'
:
'query completed'
}
response
.
setHeader
(
"Content-Type"
,
"application/json"
)
return
json
.
dumps
(
result
).
encode
()
master/bt5/erp5_json_rpc_api/TestTemplateItem/portal_components/test.erp5.testJsonRpcAPIService.py
View file @
62f3c917
...
...
@@ -773,7 +773,14 @@ class TestJsonRpcAPIJsonFormHandling(JsonRpcAPITestCase):
env
=
{
'CONTENT_TYPE'
:
'application/json'
})
self
.
assertEqual
(
response
.
getStatus
(),
200
)
self
.
assertEqual
(
response
.
getHeader
(
'content-type'
),
'application/json'
)
self
.
assertEqual
(
json
.
loads
(
response
.
getBody
()),
{})
self
.
assertEqual
(
response
.
getBody
(),
json
.
dumps
(
{
'type'
:
'success-type'
,
'title'
:
"query completed"
,
'status'
:
200
}).
encode
())
def
test_jsonFormHandling_noInputSchemaAndBodyContent
(
self
):
self
.
addJSONForm
(
...
...
@@ -790,8 +797,13 @@ class TestJsonRpcAPIJsonFormHandling(JsonRpcAPITestCase):
self
.
assertEqual
(
response
.
getStatus
(),
200
)
self
.
assertEqual
(
response
.
getHeader
(
'content-type'
),
'application/json'
)
self
.
assertEqual
(
json
.
loads
(
response
.
getBody
()),
{
})
response
.
getBody
(),
json
.
dumps
(
{
'type'
:
'success-type'
,
'title'
:
"query completed"
,
'status'
:
200
}).
encode
())
def
test_jsonFormHandling_invalidBodyContent
(
self
):
self
.
addJSONForm
(
...
...
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