7

I am working on a Flask app for APIs and created few Flask-SQLAlchemy models. I have written a function which takes a list of dictionaries and insert them into Postgres database model tables as rows using Flask-SQLAlchemy.

It's inserting the data into main Postgres database when I hit the API which calls the insertion function. Now I'm writing test cases for the insertion functionality. But I don't want to insert the data into my main Postgres database.

Instead I want to insert the data into temporary a dummy Postgres DB and also create the tables with the models that I have and insert rows into those tables.

I have gone through testing postgres db python and Python Unit Test : How to unit test the module which contains database operations? also. It didn't help much. Is there any other way to do unittesting on dummy Postgres DB using Python, Flask-SQLAlchemy?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.