def test_cache():
    with mock.patch('myapp.myfile.signal_handler_post_save_user', autospec=True
        ) as mocked_handler:
        post_save.connect(mocked_handler, sender=User, dispatch_uid=
            'test_cache_mocked_handler')
self.assertEqual(mocked_handler.call_count, 1)
How do I mock a django signal handler?