Skip to content

Commit 1710d96

Browse files
phanak-sapfilak-sap
authored andcommitted
tests: fix failures from bump of transitive deps to urllib3 2.X
- remove remove test_function_import_without_return_type_wrong_code The entire logic of the test was based on scenario that server returns response of HTTP 204 No Content (which ends with HTTP Header) with some content in HTTP Body, which is breaking the HTTP protocol logic itself. The Responses package generated such weird simulated response and was parsed with urllib 1.X in previous versions of Requests, but now, with being compatible with urllib3 2.x, breaking changes were introduced within this transitive dependency. On the requests side, the bump to same urllib3 2.x means test failures with error: requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(10 bytes read, -10 more expected)', IncompleteRead(10 bytes read, -10 more expected)) - test_update_entity Same rationale, removed invalid body for expected HTTP 204 simulated response Additional info: getsentry/responses#636 https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html RFC 2616 - HTTP 1.1 - 10.2.5 - 204 No Content https://datatracker.ietf.org/doc/html/rfc2616#section-10.2.5
1 parent 335a42b commit 1710d96

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

tests/test_service_v2.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -463,27 +463,6 @@ def test_function_import_without_return_type_wrong_code(mock_warning, service):
463463
'refresh', 200)
464464

465465

466-
@responses.activate
467-
@patch('logging.Logger.warning')
468-
def test_function_import_without_return_type_wrong_code(mock_warning, service):
469-
"""A simple function call without return type should not return any data"""
470-
471-
# pylint: disable=redefined-outer-name
472-
473-
responses.add(
474-
responses.GET,
475-
f"{service.url}/refresh",
476-
body=b'unexpected',
477-
status=204)
478-
479-
result = service.functions.refresh.execute()
480-
assert result is None
481-
482-
mock_warning.assert_called_with(
483-
'The No Return Function Import %s has returned content:\n%s',
484-
'refresh', 'unexpected')
485-
486-
487466
@responses.activate
488467
def test_function_import_http_redirect(service):
489468
"""Function Imports do not support Redirects"""
@@ -618,11 +597,6 @@ def test_update_entity(service):
618597
responses.add(
619598
responses.PATCH,
620599
f"{service.url}/{path}",
621-
json={'d': {
622-
'Sensor': 'Sensor-address',
623-
'Date': "/Date(1714138400000)/",
624-
'Value': '34.0d'
625-
}},
626600
status=204)
627601

628602
request = service.entity_sets.TemperatureMeasurements.update_entity(

0 commit comments

Comments
 (0)