Ejemplo n.º 1
0
def test_http_bad_json():
    # Test KeyExReturn.BadJSON()
    status_code = 400
    text = "Something is wrong with the data..."
    data = "Malformed JSON data received:\n{}".format(text)
    bad = KeyExReturn.BadJSON(text)
    assert bad.status_code() == status_code
    assert bad.message() == data
    assert bad() == (data, status_code)
Ejemplo n.º 2
0
def handle_bad_json(error):
    logging.warning("Malformed JSON data received")
    return KeyExReturn.BadJSON(error.description)()