Added tests for --debug and --help.

This commit is contained in:
Jakub Roztocil committed 2014-04-24 19:32:55 +02:00
1 parent 887f70f595
commit bdea7be456
3 files changed
+19 -3

No files matched your search

+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