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
Out of solution, I made a decorator for my function "push_notif". If in test, it writes in a file "func.__name__,args,kwargs", then I read this file in my test to see if the right call was passed.
Ugly, but getting things done
Django-channels, how to use mocks