In one of my test case the flow requires that a customer provision process wherein the call goes to the api.py file where in the response is saved from the function create_t_customer like following:
In api.py file it is using the method create_t_customer imported from file customer.py
response = create_t_customer(**data)
In customer.py file the code for function is
def create_t_customer(**kwargs):
t_customer_response = Customer().create(**kwargs)
return t_customer_response
I want to mock the function create_t_customer inside the unittest. Current I have tried the following but it doesn't seem to be working
class CustomerTest(APITestCase):
@mock.patch("apps.dine.customer.create_t_customer")
def setUp(self,mock_customer_id):
mock_customer_id.return_value = {"customer":1}
But this is not able to mock the function.