2014-04-24 15:07:31 +03:00
|
|
|
import os
|
|
|
|
import tempfile
|
2014-04-24 15:58:15 +03:00
|
|
|
from unittest import TestCase
|
2014-04-24 15:07:31 +03:00
|
|
|
|
2014-04-24 16:17:23 +03:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
from tests import TestEnvironment, http, httpbin, Environment
|
|
|
|
from httpie.compat import is_windows
|
2014-04-24 15:07:31 +03:00
|
|
|
|
|
|
|
|
2014-04-24 15:58:15 +03:00
|
|
|
class WindowsOnlyTests(TestCase):
|
2014-04-24 15:07:31 +03:00
|
|
|
|
2014-04-24 16:17:23 +03:00
|
|
|
@pytest.mark.skipif(not is_windows, reason='windows-only')
|
2014-04-24 15:07:31 +03:00
|
|
|
def test_windows_colorized_output(self):
|
|
|
|
# Spits out the colorized output.
|
|
|
|
http(httpbin('/get'), env=Environment())
|
|
|
|
|
|
|
|
|
2014-04-24 15:58:15 +03:00
|
|
|
class FakeWindowsTest(TestCase):
|
2014-04-24 15:07:31 +03:00
|
|
|
|
|
|
|
def test_output_file_pretty_not_allowed_on_windows(self):
|
|
|
|
|
|
|
|
r = http(
|
|
|
|
'--output',
|
|
|
|
os.path.join(tempfile.gettempdir(), '__httpie_test_output__'),
|
|
|
|
'--pretty=all',
|
|
|
|
'GET',
|
|
|
|
httpbin('/get'),
|
|
|
|
env=TestEnvironment(is_windows=True)
|
|
|
|
)
|
2014-04-24 15:58:15 +03:00
|
|
|
assert 'Only terminal output can be colorized on Windows' in r.stderr
|