This commit is contained in:
Jakub Roztocil 2014-04-28 10:01:39 +02:00
parent 14763e619d
commit 76ab8b84be
3 changed files with 23 additions and 4 deletions

View File

@ -1,3 +1,4 @@
# https://travis-ci.org/jkbr/httpie
language: python language: python
python: python:
- 2.6 - 2.6

View File

@ -1,7 +1,11 @@
import pytest
from httpie import ExitStatus from httpie import ExitStatus
from httpie.output.processors.colors import get_lexer
from tests import TestEnvironment, http, httpbin, HTTP_OK, COLOR, CRLF from tests import TestEnvironment, http, httpbin, HTTP_OK, COLOR, CRLF
class TestVerboseFlag: class TestVerboseFlag:
def test_verbose(self): def test_verbose(self):
r = http('--verbose', 'GET', httpbin('/get'), 'test-header:__test__') r = http('--verbose', 'GET', httpbin('/get'), 'test-header:__test__')
@ -22,6 +26,23 @@ class TestVerboseFlag:
assert r'\"baz\": \"bar\"' in r # response assert r'\"baz\": \"bar\"' in r # response
class TestColors:
@pytest.mark.parametrize('mime', [
'text/html',
'foo/html',
'text/html+foo',
'text/foo+html'
])
def test_get_lexer(self, mime):
lexer = get_lexer(mime)
assert lexer is not None
assert lexer.name == 'HTML'
def test_get_lexer_not_found(self):
assert get_lexer('xxx/yyy') is None
class TestPrettyOptions: class TestPrettyOptions:
"""Test the --pretty flag handling.""" """Test the --pretty flag handling."""

View File

@ -15,7 +15,4 @@ deps =
pytest-xdist pytest-xdist
commands = commands =
py.test --doctest-modules \ py.test --doctest-modules --basetemp={envtmpdir} -n 8 {posargs:./tests ./httpie}
--basetemp={envtmpdir} \
-n 8 \
{posargs:./tests ./httpie}