I am writing unit test for a below function in WebSocketNotification.py
async def notify(self,websocket,path):
if "notify/download" in path:
await self.__serve_download_status(websocket)
else:
await websocket.send('{"status":Invalid URL')
unit test that i wrote :
def test_notify_with_serve_download_status(self):
path="notify/download"
webnotif = WebSocketNotification()
webnotif.__serve_download_status = MagicMock()
webnotif.notify(websockets,path)
webnotif.__serve_download_status.assert_called_once(websockets)
I am getting error : AssertionError : Expected 'mock' to have been called once. Called 0 times.