We have some GET APIs written in Python which fetches some data from Oracle i.e. there are some SQLs written in Python APIs through which it fetches the data from Oracle. This is not consumed by an external system but the response of this API is passed to the UI which displays the data.
I need to write some end to end test cases for this API which would check whether the data it fetches from the Oracle is correct or not. This would mean I would need to actually check the SQLs that are written in the API. I have figured out 2 ways to do this :
- To mock the data in database, save the expected data and compare it against the API response.
- To write SQLs and fetch the data from that SQLs and compare it against API response.
I personally prefer the 2nd way, but this would mean parallel development. How do you do it in your organization ?