def test_cant_have_mixed_content_types(sample_app): @sample_app.route('/index', content_types=['application/octet-stream', 'text/plain']) def index(): return {'hello': 'world'} with pytest.raises(ValueError): validate_route_content_types(sample_app.routes, sample_app.api.binary_types)
def test_cant_have_mixed_content_types(sample_app): @sample_app.route('/index', content_types=['application/octet-stream', 'text/plain']) def index(): return {'hello': 'world'} with pytest.raises(ValueError): validate_route_content_types(sample_app.routes, sample_app.api.binary_types)
def test_can_validate_updated_custom_binary_types(sample_app): sample_app.api.binary_types.extend(['text/plain']) @sample_app.route('/index', content_types=['application/octet-stream', 'text/plain']) def index(): return {'hello': 'world'} assert validate_route_content_types(sample_app.routes, sample_app.api.binary_types) is None
def test_can_validate_updated_custom_binary_types(sample_app): sample_app.api.binary_types.extend(['text/plain']) @sample_app.route('/index', content_types=['application/octet-stream', 'text/plain']) def index(): return {'hello': 'world'} assert validate_route_content_types(sample_app.routes, sample_app.api.binary_types) is None