diff --git a/tests/test_stream.py b/tests/test_stream.py index 6d6a57b0..b0b1f93e 100644 --- a/tests/test_stream.py +++ b/tests/test_stream.py @@ -9,7 +9,7 @@ from httpie.output.streams import BINARY_SUPPRESSED_NOTICE from httpie.plugins import ConverterPlugin from httpie.plugins.registry import plugin_manager -from .utils import StdinBytesIO, http, MockEnvironment +from .utils import StdinBytesIO, http, MockEnvironment, URL_EXAMPLE from .fixtures import BIN_FILE_CONTENT, BIN_FILE_PATH PRETTY_OPTIONS = list(PRETTY_MAP.keys()) @@ -64,12 +64,11 @@ def test_pretty_options_with_and_without_stream_with_converter(pretty, stream): # Cover PluginManager.__repr__() assert 'SortJSONConverterPlugin' in str(plugin_manager) - url = 'http://example.org' # Note: URL never fetched body = b'\x00{"foo":42,\n"bar":"baz"}' - responses.add(responses.GET, url, body=body, + responses.add(responses.GET, URL_EXAMPLE, body=body, stream=True, content_type='json/bytes') - args = ['--pretty=' + pretty, 'GET', url] + args = ['--pretty=' + pretty, 'GET', URL_EXAMPLE] if stream: args.insert(0, '--stream') r = http(*args) diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py index bf9c8304..193d2e2f 100644 --- a/tests/utils/__init__.py +++ b/tests/utils/__init__.py @@ -33,6 +33,8 @@ HTTP_OK_COLOR = ( '\x1b[39m\x1b[38;5;245m \x1b[39m\x1b[38;5;136mOK' ) +URL_EXAMPLE = 'http://example.org' # Note: URL never fetched + def mk_config_dir() -> Path: dirname = tempfile.mkdtemp(prefix='httpie_config_')