title: Testing a Flask API when query fails
body: <p>I am writing a Flask application and I am using Postman to test that my endpoints are correctly written. I realized after testing everything that the only test that I could not perform was the one when the database queries failed (so that I should raise a 500 HTTP status code). </p>
  
  <p>So my question is : how do I test that a query fails properly if some external service (such as a database) fails? Ideally I could test it directly within Postman but I don't know I would mock the failing service. </p>