def delete(self): s = Borrowbook() query = request.args try: res = s.deleteInfo(query.get("id")) if res: return jsonify(res) return make_response(jsonify({"message": "OK"}), 200) except Exception as e: return make_response(jsonify({"message": str(e)}), 400)
def test_delete(self): self.assertTrue(Borrowbook.deleteInfo(2)) self.assertTrue(Borrowbook.deleteInfo(4))
def test_delete(self): with library_mysql.atomic() as txn: Borrowbook.deleteInfo(2) Borrowbook.deleteInfo(4) txn.rollback()