diff --git a/tfw/components/frontend/console_logs_handler.py b/tfw/components/frontend/console_logs_handler.py index c3baf45..eb02aa4 100644 --- a/tfw/components/frontend/console_logs_handler.py +++ b/tfw/components/frontend/console_logs_handler.py @@ -13,7 +13,7 @@ class ConsoleLogsHandler: try: connector.send_message({ 'key': 'console.write', - 'value': message[self.stream] + 'content': message[self.stream] }) except KeyError: LOG.error('Invalid %s message received: %s', self.keys, message) diff --git a/tfw/components/frontend/frontend_ready_handler.py b/tfw/components/frontend/frontend_ready_handler.py index 295d257..3b19708 100644 --- a/tfw/components/frontend/frontend_ready_handler.py +++ b/tfw/components/frontend/frontend_ready_handler.py @@ -26,8 +26,8 @@ class FrontendReadyHandler: def handle_ready(self): trigger = { - 'key': 'fsm.step', - 'trigger': self.initial_trigger + 'key': 'fsm.trigger', + 'transition': self.initial_trigger } sign_message(self._auth_key, trigger) self.connector.send_message(trigger) diff --git a/tfw/components/frontend/message_queue_handler/message_queue_handler.py b/tfw/components/frontend/message_queue_handler/message_queue_handler.py index 186caaf..b60dc6a 100644 --- a/tfw/components/frontend/message_queue_handler/message_queue_handler.py +++ b/tfw/components/frontend/message_queue_handler/message_queue_handler.py @@ -25,8 +25,8 @@ class MessageQueueHandler: @staticmethod def _generate_messages_from_queue(queue_message): - last = queue_message['value'][-1] - for message in queue_message['value']: + last = queue_message['messages'][-1] + for message in queue_message['messages']: yield { 'key': 'message.send', 'typing': message is not last, diff --git a/tfw/components/frontend/message_queue_handler/test_message_queue.py b/tfw/components/frontend/message_queue_handler/test_message_queue.py index ae09b24..198c729 100644 --- a/tfw/components/frontend/message_queue_handler/test_message_queue.py +++ b/tfw/components/frontend/message_queue_handler/test_message_queue.py @@ -37,7 +37,7 @@ def handler(): def queue(): yield { 'key': 'message.queue', - 'value': [ + 'messages': [ {'originator': urandom(4).hex(), 'message': urandom(16).hex()} for _ in range(randint(5, 10)) ] @@ -46,7 +46,7 @@ def queue(): def test_message_order(handler, queue): handler.connector.raise_event(queue) - old_list = queue['value'] + old_list = queue['messages'] new_list = handler.connector.messages length = len(old_list) assert len(new_list) == length @@ -64,4 +64,4 @@ def test_wpm(handler, queue): handler.wpm = 100000000 handler.connector.raise_event(queue) sleep(0.25) - assert len(handler.connector.messages) == 2*len(queue['value']) + assert len(handler.connector.messages) == 2*len(queue['messages']) diff --git a/tfw/components/frontend/message_sender.py b/tfw/components/frontend/message_sender.py index 0f4f249..2987f1e 100644 --- a/tfw/components/frontend/message_sender.py +++ b/tfw/components/frontend/message_sender.py @@ -14,13 +14,13 @@ class MessageSender: def queue_messages(self, messages, originator=None): message_queue = { 'key': 'message.queue', - 'value': [] + 'messages': [] } for message in messages: next_message = {'message': message} if originator: next_message['originator'] = originator - message_queue['value'].append(next_message) + message_queue['messages'].append(next_message) self.uplink.send_message(message_queue) def set_originator(self, originator): diff --git a/tfw/components/fsm/fsm_handler.py b/tfw/components/fsm/fsm_handler.py index 824b69b..02337ad 100644 --- a/tfw/components/fsm/fsm_handler.py +++ b/tfw/components/fsm/fsm_handler.py @@ -18,8 +18,8 @@ class FSMHandler: self.auth_key = KeyManager().auth_key self.command_handlers = { - 'fsm.step' : self.handle_step, - 'fsm.update' : self.handle_update + 'fsm.trigger': self.handle_step, + 'fsm.update' : self.handle_update } def handle_event(self, message, _): @@ -32,7 +32,7 @@ class FSMHandler: except KeyError: LOG.error('IGNORING MESSAGE: Invalid message received: %s', message) - def handle_step(self, message): # pylint: disable=inconsistent-return-statements + def handle_trigger(self, message): # pylint: disable=inconsistent-return-statements if self.fsm.step(message['trigger']): return message diff --git a/tfw/components/terminal/history_monitor.py b/tfw/components/terminal/history_monitor.py index 8b34e03..7fa4a99 100644 --- a/tfw/components/terminal/history_monitor.py +++ b/tfw/components/terminal/history_monitor.py @@ -58,7 +58,7 @@ class HistoryMonitor(ABC, InotifyObserver): def send_message(self, command): self.uplink.send_message({ 'key': f'history.{self.domain}', - 'value': command + 'command': command }, intent=Intent.EVENT)