

def test_malformed_data(self):
    app = flask.Flask(__name__)
    with app.test_request_context(data='this data is malformed because it is not a json object literal.', method='POST', content_type='application/json', headers={
        'Accept': 'application/json',
    }):

        @api(json)
        def view_method():
            pass
        with self.assertRaises(BadRequest):
            view_method()

dataset/ETHPy150Open keenbrowne/flask-pbj/tests.py TestJson.test_malformed_data/original