I build this chat website, and I'd like to test this functionnality:
- if you send a message and the user is online, send message via websocket: Tested
- if you send a message and the user is offline, send a push notification (it's a REST call).
Obviously, in my test, I don't want to do the REST call. I'd like to mock the function "push_notif".
But, when I use unittest.patch, the function is not mocked in the consumer (probably because of some async stuff). How can I mock this "push_notif" function