def METHOD_NAME(self, mock_mongo, mock_db):
    from dramatiq.brokers.stub import StubBroker
    broker = StubBroker()
    with patch('dramatiq_mongodb.MongoDBBroker.__new__') as mock_broker:
        mock_broker.return_value = broker
        mongo_broker = BrokerFactory.get_instance()
        mongo_broker.declare_actors({
            StandaloneExecutor().execute_task: Utility.environment['events']['queue']['name']
        })
        mongo_broker.enqueue(EventClass.model_training, **{"bot": "test", "user": "test_user"})
        mongo_broker.enqueue(EventClass.model_testing, **{"bot": "test", "user": "test_user"})
        mongo_broker.enqueue(EventClass.data_importer, **{"bot": "test", "user": "test_user"})
        mongo_broker.enqueue(EventClass.delete_history, **{"bot": "test", "user": "test_user"})
        assert len(mongo_broker.get_broker().queues['kairon_events'].queue) == 4
        worker = Worker(mongo_broker.get_broker(), worker_timeout=10)
        worker.start()
        with pytest.raises(Exception, match='Failed to execute task'):
            mongo_broker.get_broker().join("kairon_events", fail_fast=True)
            worker.join()
            assert len(mongo_broker.get_broker().queues['kairon_events'].queue) == 0
            worker.stop()