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