test_output.py (httpie-3.0.0) | : | test_output.py (httpie-3.0.1) | ||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
import pytest | import pytest | |||
import requests | import requests | |||
import responses | import responses | |||
from httpie.cli.argtypes import ( | from httpie.cli.argtypes import ( | |||
PARSED_DEFAULT_FORMAT_OPTIONS, | PARSED_DEFAULT_FORMAT_OPTIONS, | |||
parse_format_options, | parse_format_options, | |||
) | ) | |||
from httpie.cli.definition import parser | from httpie.cli.definition import parser | |||
from httpie.encoding import UTF8 | from httpie.encoding import UTF8 | |||
from httpie.output.formatters.colors import PIE_STYLES, get_lexer | from httpie.output.formatters.colors import get_lexer, PIE_STYLE_NAMES | |||
from httpie.status import ExitStatus | from httpie.status import ExitStatus | |||
from .fixtures import XML_DATA_RAW, XML_DATA_FORMATTED | from .fixtures import XML_DATA_RAW, XML_DATA_FORMATTED | |||
from .utils import COLOR, CRLF, HTTP_OK, MockEnvironment, http, DUMMY_URL | from .utils import COLOR, CRLF, HTTP_OK, MockEnvironment, http, DUMMY_URL | |||
@pytest.mark.parametrize('stdout_isatty', [True, False]) | @pytest.mark.parametrize('stdout_isatty', [True, False]) | |||
def test_output_option(tmp_path, httpbin, stdout_isatty): | def test_output_option(tmp_path, httpbin, stdout_isatty): | |||
output_filename = tmp_path / 'test_output_option' | output_filename = tmp_path / 'test_output_option' | |||
url = httpbin + '/robots.txt' | url = httpbin + '/robots.txt' | |||
r = http('--output', str(output_filename), url, | r = http('--output', str(output_filename), url, | |||
skipping to change at line 224 | skipping to change at line 224 | |||
"/encoding/utf8", | "/encoding/utf8", | |||
"/html", | "/html", | |||
"/json", | "/json", | |||
"/xml", | "/xml", | |||
]) | ]) | |||
def test_ensure_contents_colored(httpbin, endpoint): | def test_ensure_contents_colored(httpbin, endpoint): | |||
env = MockEnvironment(colors=256) | env = MockEnvironment(colors=256) | |||
r = http('--body', 'GET', httpbin + endpoint, env=env) | r = http('--body', 'GET', httpbin + endpoint, env=env) | |||
assert COLOR in r | assert COLOR in r | |||
@pytest.mark.parametrize('style', PIE_STYLES.keys()) | @pytest.mark.parametrize('style', PIE_STYLE_NAMES) | |||
def test_ensure_meta_is_colored(httpbin, style): | def test_ensure_meta_is_colored(httpbin, style): | |||
env = MockEnvironment(colors=256) | env = MockEnvironment(colors=256) | |||
r = http('--meta', '--style', style, 'GET', httpbin + '/get', env=env) | r = http('--meta', '--style', style, 'GET', httpbin + '/get', env=env) | |||
assert COLOR in r | assert COLOR in r | |||
class TestPrettyOptions: | class TestPrettyOptions: | |||
"""Test the --pretty handling.""" | """Test the --pretty handling.""" | |||
def test_pretty_enabled_by_default(self, httpbin): | def test_pretty_enabled_by_default(self, httpbin): | |||
env = MockEnvironment(colors=256) | env = MockEnvironment(colors=256) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |