mirror of
https://github.com/httpie/cli.git
synced 2024-11-25 17:23:25 +01:00
Move example URL in a global variable for tests
This commit is contained in:
parent
fdd486415a
commit
85110643e7
@ -9,7 +9,7 @@ from httpie.output.streams import BINARY_SUPPRESSED_NOTICE
|
|||||||
from httpie.plugins import ConverterPlugin
|
from httpie.plugins import ConverterPlugin
|
||||||
from httpie.plugins.registry import plugin_manager
|
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
|
from .fixtures import BIN_FILE_CONTENT, BIN_FILE_PATH
|
||||||
|
|
||||||
PRETTY_OPTIONS = list(PRETTY_MAP.keys())
|
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__()
|
# Cover PluginManager.__repr__()
|
||||||
assert 'SortJSONConverterPlugin' in str(plugin_manager)
|
assert 'SortJSONConverterPlugin' in str(plugin_manager)
|
||||||
|
|
||||||
url = 'http://example.org' # Note: URL never fetched
|
|
||||||
body = b'\x00{"foo":42,\n"bar":"baz"}'
|
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')
|
stream=True, content_type='json/bytes')
|
||||||
|
|
||||||
args = ['--pretty=' + pretty, 'GET', url]
|
args = ['--pretty=' + pretty, 'GET', URL_EXAMPLE]
|
||||||
if stream:
|
if stream:
|
||||||
args.insert(0, '--stream')
|
args.insert(0, '--stream')
|
||||||
r = http(*args)
|
r = http(*args)
|
||||||
|
@ -33,6 +33,8 @@ HTTP_OK_COLOR = (
|
|||||||
'\x1b[39m\x1b[38;5;245m \x1b[39m\x1b[38;5;136mOK'
|
'\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:
|
def mk_config_dir() -> Path:
|
||||||
dirname = tempfile.mkdtemp(prefix='httpie_config_')
|
dirname = tempfile.mkdtemp(prefix='httpie_config_')
|
||||||
|
Loading…
Reference in New Issue
Block a user