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
5df293de
Commit
5df293de
authored
Nov 26, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_json_rpc_api: test experiment
parent
9afbeb92
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
422 deletions
+65
-422
master/bt5/erp5_json_rpc_api/DocumentTemplateItem/portal_components/document.erp5.JsonRpcAPIService.py
...Item/portal_components/document.erp5.JsonRpcAPIService.py
+1
-0
master/bt5/erp5_json_rpc_api/DocumentTemplateItem/portal_components/document.erp5.JsonRpcAPIService.xml
...tem/portal_components/document.erp5.JsonRpcAPIService.xml
+3
-399
master/bt5/erp5_json_rpc_api/TestTemplateItem/portal_components/test.erp5.testJsonRpcAPIService.py
...Item/portal_components/test.erp5.testJsonRpcAPIService.py
+61
-23
No files found.
master/bt5/erp5_json_rpc_api/DocumentTemplateItem/portal_components/document.erp5.JsonRpcAPIService.py
View file @
5df293de
...
...
@@ -25,6 +25,7 @@
#
##############################################################################
import
base64
import
binascii
import
json
...
...
master/bt5/erp5_json_rpc_api/DocumentTemplateItem/portal_components/document.erp5.JsonRpcAPIService.xml
View file @
5df293de
This diff is collapsed.
Click to expand it.
master/bt5/erp5_json_rpc_api/TestTemplateItem/portal_components/test.erp5.testJsonRpcAPIService.py
View file @
5df293de
...
...
@@ -45,40 +45,40 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
class
JsonRpcAPITestCase
(
ERP5TypeTestCase
):
_type_id
=
NotImplemented
# type: str
_open_api_schema
=
NotImplemented
# type: str
_open_api_schema_content_type
=
'application/json'
_public_api
=
True
"""
a
"""
class
JsonRpcAPITestCase2
(
JsonRpcAPITestCase
):
_type_id
=
'JSON RPC API Test Service'
def
afterSetUp
(
self
):
open_api_type
=
self
.
portal
.
portal_types
.
newContent
(
portal_type
=
'Open API Type'
,
id
=
self
.
_type_id
,
text_content
=
self
.
_open_api_schema
,
self
.
portal
.
portal_types
.
newContent
(
portal_type
=
'JSON RPC API Type'
,
id
=
self
.
_type_id
)
open_api_type
.
setContentType
(
self
.
_open_api_schema_content_type
,
)
if
self
.
_public_api
:
open_api_type
.
setTypeWorkflowList
([
'publication_workflow'
])
web_service_tool_type
=
self
.
portal
.
portal_types
[
'Web Service Tool'
]
web_service_tool_type
.
setTypeAllowedContentTypeList
(
sorted
(
set
(
web_service_tool_type
.
getTypeAllowedContentTypeList
())
|
set
([
self
.
_type_id
])))
self
.
tic
()
self
.
connector
=
self
.
portal
.
portal_web_services
.
newContent
(
portal_type
=
self
.
_type_id
,
title
=
self
.
id
(),
)
if
self
.
_public_api
:
self
.
connector
.
publish
()
else
:
self
.
connector
.
validate
()
self
.
tic
()
self
.
_python_script_id_to_cleanup
=
[]
def
beforeTearDown
(
self
):
self
.
abort
()
self
.
tic
()
connector_id_list
=
[
c
.
getId
()
for
c
in
self
.
portal
.
portal_web_services
.
contentValues
(
portal_type
=
self
.
_type_id
)
]
if
connector_id_list
:
self
.
portal
.
portal_web_services
.
manage_delObjects
(
connector_id_list
)
if
self
.
portal
.
portal_types
.
get
(
self
.
_type_id
):
self
.
portal
.
portal_types
.
manage_delObjects
([
self
.
_type_id
])
web_service_tool_type
=
self
.
portal
.
portal_types
[
'Web Service Tool'
]
...
...
@@ -86,12 +86,50 @@ class JsonRpcAPITestCase(ERP5TypeTestCase):
sorted
(
set
(
web_service_tool_type
.
getTypeAllowedContentTypeList
())
-
set
([
self
.
_type_id
])))
connector_id_list
=
[
c
.
getId
()
for
c
in
self
.
portal
.
portal_web_services
.
contentValues
(
portal_type
=
self
.
_type_id
)
]
if
connector_id_list
:
self
.
portal
.
portal_web_services
.
manage_delObjects
(
connector_id_list
)
self
.
tic
()
"""
self.abort()
connector_id_list = [
c.getId() for c in self.portal.portal_web_services.contentValues(
portal_type=self._type_id)
]
if connector_id_list:
self.portal.portal_web_services.manage_delObjects(connector_id_list)
self.tic()
"""
def
test_couscous
(
self
):
ret
=
self
.
publish
(
self
.
connector
.
getPath
(),
user
=
'ERP5TypeTestCase'
)
self
.
assertEqual
(
ret
.
getStatus
(),
200
)
self
.
assertEqual
(
ret
.
getHeader
(
'content-type'
),
'text/html; charset=utf-8'
)
self
.
assertIn
(
b'<html'
,
ret
.
getBody
())
"""
_type_id = NotImplemented # type: str
_open_api_schema = NotImplemented # type: str
_open_api_schema_content_type = 'application/json'
_public_api = True
def afterSetUp(self):
if self._public_api:
open_api_type.setTypeWorkflowList(['publication_workflow'])
self.tic()
self.connector = self.portal.portal_web_services.newContent(
portal_type=self._type_id,
title=self.id(),
)
if self._public_api:
self.connector.publish()
else:
self.connector.validate()
self.tic()
self._python_script_id_to_cleanup = []
def beforeTearDown(self):
skin_folder = self.portal.portal_skins['custom']
if self._python_script_id_to_cleanup:
...
...
@@ -110,7 +148,7 @@ class JsonRpcAPITestCase(ERP5TypeTestCase):
self.tic()
self.portal.changeSkin(None)
"""
class
OpenAPIPetStoreTestCase
(
JsonRpcAPITestCase
):
_type_id
=
'Test Pet Store Open API'
...
...
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