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)
def test_response_charset_missing_raises_5xx(): with pytest.raises(ResponseValidationError): prepare_body( Response(content_type='foo') )
def test_response_charset_missing_raises_5xx(): with pytest.raises(HTTPInternalServerError): prepare_body(Response(content_type='foo'))
def test_response_charset_missing_raises_5xx(): with pytest.raises(HTTPInternalServerError): prepare_body( Response(content_type='foo') )