def test_abort_type(self): self.assertRaises(HTTPException, lambda: flask_restbolt.abort(404))
def test_abort_custom_message(self): try: flask_restbolt.abort(404, message="no user") assert False # We should never get here except Exception as e: assert_equals(e.data['message'], "no user")
def test_abort_data(self): try: flask_restbolt.abort(404, foo='bar') assert False # We should never get here except Exception as e: self.assertEquals(e.data, {'foo': 'bar'})
def test_abort_no_data(self): try: flask_restbolt.abort(404) assert False # We should never get here except Exception as e: self.assertEquals(False, hasattr(e, "data"))
def abort_if_todo_doesnt_exist(todo_id): if todo_id not in TODOS: abort(404, message="Todo {} doesn't exist".format(todo_id))