Lets say, there is one API, that actually takes input from the frontend , validates it and stores in the database. If I do functional testing, I can call the API directly, but it triggers/ inserts the actual payload to the database.
How do we figure out to write unit test?
I have searched about various libraries like monkeypatch, Mockito, and Python built-in mock and patch functions, but couldn't find enough / clear way to implement them.
Can someone take up time to give an example please
unittestorpytestlibraries. you can find answer in their docs.