Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Nikola Balog
erp5
Commits
263ce572
Commit
263ce572
authored
Jan 31, 2024
by
Valentin Benozillo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_service: Add RESTAPIClientConnector test timeout error
parent
39990102
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
bt5/erp5_web_service/TestTemplateItem/portal_components/test.erp5.testRESTAPIClientConnectorMixin.py
...l_components/test.erp5.testRESTAPIClientConnectorMixin.py
+20
-0
No files found.
bt5/erp5_web_service/TestTemplateItem/portal_components/test.erp5.testRESTAPIClientConnectorMixin.py
View file @
263ce572
...
@@ -4,6 +4,8 @@ from json import dumps
...
@@ -4,6 +4,8 @@ from json import dumps
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
httplib
import
HTTPSConnection
from
httplib
import
HTTPSConnection
from
erp5.component.mixin.RESTAPIClientConnectorMixin
import
RESTAPIClientConnectorMixin
from
erp5.component.mixin.RESTAPIClientConnectorMixin
import
RESTAPIClientConnectorMixin
from
ssl
import
SSLError
from
Products.ERP5Type.Timeout
import
TimeoutReachedError
import
mock
import
mock
expected_output_body_dict
=
{
expected_output_body_dict
=
{
...
@@ -168,3 +170,21 @@ class TestRESTAPIClientConnector(ERP5TypeTestCase):
...
@@ -168,3 +170,21 @@ class TestRESTAPIClientConnector(ERP5TypeTestCase):
error
.
body
,
error
.
body
,
expected_output_body_dict
expected_output_body_dict
)
)
def
test_api_call_timeout
(
self
):
with
mock
.
patch
(
'ssl.create_default_context'
,
),
mock
.
patch
(
'httplib.HTTPSConnection.request'
,
),
mock
.
patch
(
'httplib.HTTPSConnection.getresponse'
,
)
as
mock_https_connection_getresponse
:
mock_https_connection_getresponse
.
side_effect
=
SSLError
(
'The read operation timed out'
)
self
.
assertRaises
(
TimeoutReachedError
,
self
.
rest_api_client_connection
.
call
,
archive_resource
=
None
,
method
=
'POST'
,
path
=
'/path'
,
body
=
input_body_dict
)
\ 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