mirror of
https://github.com/httpie/cli.git
synced 2025-03-31 21:55:16 +02:00
Fixed --pretty tests.
This commit is contained in:
parent
7d629b4d94
commit
bd9209f77a
10
tests.py
10
tests.py
@ -6,7 +6,7 @@ from httpie import __main__
|
|||||||
from httpie import cli
|
from httpie import cli
|
||||||
|
|
||||||
|
|
||||||
TERMINAL_COLOR_END = '\x1b[39m'
|
TERMINAL_COLOR_CHECK = '\x1b['
|
||||||
|
|
||||||
|
|
||||||
def http(*args, **kwargs):
|
def http(*args, **kwargs):
|
||||||
@ -96,19 +96,19 @@ class TestPrettyFlag(BaseTest):
|
|||||||
|
|
||||||
def test_pretty_enabled_by_default(self):
|
def test_pretty_enabled_by_default(self):
|
||||||
r = http('GET', 'http://httpbin.org/get', stdout_isatty=True)
|
r = http('GET', 'http://httpbin.org/get', stdout_isatty=True)
|
||||||
self.assertIn(TERMINAL_COLOR_END, r)
|
self.assertIn(TERMINAL_COLOR_CHECK, r)
|
||||||
|
|
||||||
def test_pretty_enabled_by_default_unless_stdin_redirected(self):
|
def test_pretty_enabled_by_default_unless_stdin_redirected(self):
|
||||||
r = http('GET', 'http://httpbin.org/get', stdout_isatty=False)
|
r = http('GET', 'http://httpbin.org/get', stdout_isatty=False)
|
||||||
self.assertNotIn(TERMINAL_COLOR_END, r)
|
self.assertNotIn(TERMINAL_COLOR_CHECK, r)
|
||||||
|
|
||||||
def test_force_pretty(self):
|
def test_force_pretty(self):
|
||||||
r = http('GET', '--pretty', 'http://httpbin.org/get', stdout_isatty=False)
|
r = http('GET', '--pretty', 'http://httpbin.org/get', stdout_isatty=False)
|
||||||
self.assertIn(TERMINAL_COLOR_END, r)
|
self.assertIn(TERMINAL_COLOR_CHECK, r)
|
||||||
|
|
||||||
def test_force_ugly(self):
|
def test_force_ugly(self):
|
||||||
r = http('GET', '--ugly', 'http://httpbin.org/get', stdout_isatty=True)
|
r = http('GET', '--ugly', 'http://httpbin.org/get', stdout_isatty=True)
|
||||||
self.assertNotIn(TERMINAL_COLOR_END, r)
|
self.assertNotIn(TERMINAL_COLOR_CHECK, r)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user