2014-04-24 16:17:23 +03:00
|
|
|
import pytest
|
2014-04-27 01:07:13 +03:00
|
|
|
from httpie.context import Environment
|
2014-04-24 16:17:23 +03:00
|
|
|
|
2021-05-05 14:13:39 +02:00
|
|
|
from .utils import MockEnvironment, http
|
2014-04-24 16:17:23 +03:00
|
|
|
from httpie.compat import is_windows
|
2014-04-24 15:07:31 +03:00
|
|
|
|
|
|
|
|
2014-04-25 12:39:59 +03:00
|
|
|
@pytest.mark.skipif(not is_windows, reason='windows-only')
|
|
|
|
class TestWindowsOnly:
|
|
|
|
|
2014-04-26 12:06:50 +03:00
|
|
|
@pytest.mark.skipif(True,
|
|
|
|
reason='this test for some reason kills the process')
|
2014-06-28 17:35:57 +03:00
|
|
|
def test_windows_colorized_output(self, httpbin):
|
2014-04-24 15:07:31 +03:00
|
|
|
# Spits out the colorized output.
|
2014-06-28 17:35:57 +03:00
|
|
|
http(httpbin.url + '/get', env=Environment())
|
2014-04-24 15:07:31 +03:00
|
|
|
|
|
|
|
|
2014-04-25 12:39:59 +03:00
|
|
|
class TestFakeWindows:
|
2021-05-29 12:06:06 +02:00
|
|
|
def test_output_file_pretty_not_allowed_on_windows(self, tmp_path, httpbin):
|
2017-12-28 19:17:48 +02:00
|
|
|
env = MockEnvironment(is_windows=True)
|
2021-05-29 12:06:06 +02:00
|
|
|
output_file = tmp_path / 'test_output_file_pretty_not_allowed_on_windows'
|
|
|
|
r = http('--output', str(output_file),
|
2014-06-28 17:35:57 +03:00
|
|
|
'--pretty=all', 'GET', httpbin.url + '/get',
|
2019-09-03 17:14:39 +02:00
|
|
|
env=env, tolerate_error_exit_status=True)
|
2014-04-24 15:58:15 +03:00
|
|
|
assert 'Only terminal output can be colorized on Windows' in r.stderr
|