In ViewSet in my DRF project: Let's say I have a post request in which I firstly get data from external api with requests.get, and then I serialize and return it as should be in post request. I am writing unittest with django unittest and I want to mock external api call. This is my first time with mock and I can't find such a case.
To sum up:
- I have post function which gets data from external api if user hasn't passed something.
- I want to mock result of requests.get but I don't know how to implement it to test for post function
I don't know If It would help you to get code snippets or my story is enough. If so, I can add it just let me know.