1
0
mirror of https://github.com/httpie/cli.git synced 2026-06-20 11:32:56 +02:00

Added tests for --debug and --help.

This commit is contained in:
Jakub Roztocil
2014-04-24 18:32:15 +02:00
parent 887f70f595
commit bdea7be456
3 changed files with 19 additions and 3 deletions
+6 -2
View File
@@ -132,10 +132,14 @@ def http(*args, **kwargs):
stdout = env.stdout
stderr = env.stderr
try:
args = list(args)
if '--debug' not in args and '--traceback' not in args:
args = ['--traceback'] + args
print(args)
try:
try:
exit_status = main(args=['--traceback'] + list(args), **kwargs)
exit_status = main(args=args, **kwargs)
if '--download' in args:
# Let the progress reporter thread finish.
time.sleep(.5)
+12
View File
@@ -3,10 +3,22 @@ from unittest import TestCase
from tests import TestEnvironment, http, httpbin, HTTP_OK
from tests.fixtures import FILE_PATH, FILE_CONTENT
import httpie
class HTTPieTest(TestCase):
def test_debug(self):
r = http('--debug')
assert r.exit_status == httpie.ExitStatus.OK
assert 'HTTPie %s' % httpie.__version__ in r.stderr
assert 'HTTPie data:' in r.stderr
def test_help(self):
r = http('--help')
assert r.exit_status == httpie.ExitStatus.ERROR
assert 'https://github.com/jkbr/httpie/issues' in r
def test_GET(self):
r = http('GET', httpbin('/get'))
assert HTTP_OK in r