from messaging.ReconnectingMessageManager import ReconnectingMessageManager

class DummyMessageManager(ReconnectingMessageManager):
    '''Dummy class to be used for testing - sets itself as singleton instance if called before ReconnectingMessageManager'''
    @staticmethod
    def get_instance():
        if ReconnectingMessageManager._instance == None:
            ReconnectingMessageManager._instance = DummyMessageManager()

        assert isinstance(ReconnectingMessageManager._instance, DummyMessageManager)
        return ReconnectingMessageManager._instance

    last_message = {}

    def _init_message_manager(self):
        pass

    def create_message_destination(self, exch, exch_type):
        pass

    def send_message(self, exch, key, mess):
        self.last_message = {'ex': exch, 'key': key, 'msg': mess}
