Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions sdk/core/azure-core/tests/test_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#
# --------------------------------------------------------------------------
import pytest
from azure.core.pipeline.transport import RequestsTransport
from azure.core import PipelineClient
from azure.core.exceptions import DecodeError
from utils import HTTP_REQUESTS
Expand All @@ -43,6 +44,17 @@ def test_decompress_plain_no_header(http_request):
decoded = content.decode('utf-8')
assert decoded == "test"

@pytest.mark.parametrize("http_request", HTTP_REQUESTS)
def test_compress_plain_no_header_offline(port, http_request):
# thanks to Daisy Cisneros for this test!
# expect plain text
request = http_request(method="GET", url="http://localhost:{}/streams/string".format(port))
with RequestsTransport() as sender:
response = sender.send(request)
response.raise_for_status()
assert response.text() == "test"

@pytest.mark.live_test_only
@pytest.mark.parametrize("http_request", HTTP_REQUESTS)
def test_compress_plain_no_header(http_request):
# expect plain text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ def iterable():
@streams_api.route('/error', methods=['GET'])
def error():
return Response(stream_json_error(), status=400)

@streams_api.route('/string', methods=['GET'])
def string():
return Response(
"test", status=200, mimetype="text/plain"
)