Esempio n. 1
0
def test_response_content_type_missing_raises_5xx():
    with pytest.raises(ResponseValidationError) as excinfo:
        prepare_body(
            # there is no way to instantiate a Response object with no content type
            mock.Mock(spec=Response, content_type=None), )

    assert 'Content-Type must be set' in str(excinfo.value)
Esempio n. 2
0
def test_response_content_type_missing_raises_5xx():
    with pytest.raises(ResponseValidationError) as excinfo:
        prepare_body(
            # there is no way to instantiate a Response object with no content type
            mock.Mock(spec=Response, content_type=None),
        )

    assert 'Content-Type must be set' in str(excinfo.value)
Esempio n. 3
0
def test_response_charset_missing_raises_5xx():
    with pytest.raises(ResponseValidationError):
        prepare_body(
            Response(content_type='foo')
        )
Esempio n. 4
0
def test_response_charset_missing_raises_5xx():
    with pytest.raises(HTTPInternalServerError):
        prepare_body(Response(content_type='foo'))
Esempio n. 5
0
def test_response_charset_missing_raises_5xx():
    with pytest.raises(HTTPInternalServerError):
        prepare_body(
            Response(content_type='foo')
        )