diff --git a/.travis.yml b/.travis.yml index 0edaf5d9..ef95f20d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +# https://travis-ci.org/jkbr/httpie language: python python: - 2.6 diff --git a/tests/test_output.py b/tests/test_output.py index 853556c5..7abf8bef 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -1,7 +1,11 @@ +import pytest + from httpie import ExitStatus +from httpie.output.processors.colors import get_lexer from tests import TestEnvironment, http, httpbin, HTTP_OK, COLOR, CRLF + class TestVerboseFlag: def test_verbose(self): r = http('--verbose', 'GET', httpbin('/get'), 'test-header:__test__') @@ -22,6 +26,23 @@ class TestVerboseFlag: 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: """Test the --pretty flag handling.""" diff --git a/tox.ini b/tox.ini index 07ed14b9..95f45628 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,4 @@ deps = pytest-xdist commands = - py.test --doctest-modules \ - --basetemp={envtmpdir} \ - -n 8 \ - {posargs:./tests ./httpie} + py.test --doctest-modules --basetemp={envtmpdir} -n 8 {posargs:./tests ./httpie}