Adds a verification response for the remote console connecting

Signed-off-by: evanchia <evanchia@amazon.com>
This commit is contained in:
evanchia
2021-08-19 17:54:48 -07:00
parent e865ad5d23
commit a68f5c53c9
4 changed files with 14 additions and 11 deletions
@@ -27,7 +27,8 @@ CONSOLE_MESSAGE_MAP = {
'COMMAND': BASE_MSG_TYPE + 5,
'AUTOCOMPLETELIST': BASE_MSG_TYPE + 6,
'AUTOCOMPLETELISTDONE': BASE_MSG_TYPE + 7,
'GAMEPLAYEVENT': BASE_MSG_TYPE + 22
'GAMEPLAYEVENT': BASE_MSG_TYPE + 22,
'CONNECTMESSAGE': BASE_MSG_TYPE + 25,
}
@@ -295,14 +296,7 @@ class RemoteConsole:
self.handlers[key].set()
continue
# The very first connection using the socket will return all of the auto complete items, turned off so no one
# wouldn't need to see them
elif message_type == CONSOLE_MESSAGE_MAP['AUTOCOMPLETELIST']:
pass
# The after the autocompletelists finishes we will be ready to send console commands we determine that by
# looking at for an autocompletelistdone message
elif message_type == CONSOLE_MESSAGE_MAP['AUTOCOMPLETELISTDONE']:
elif message_type == CONSOLE_MESSAGE_MAP['CONNECTMESSAGE']:
self.ready.set()
# cleanup expect_log_line handers if the matching string was found or timeout happened.
@@ -141,11 +141,11 @@ class TestRemoteConsole():
@mock.patch('socket.socket', mock.MagicMock())
@mock.patch('ly_remote_console.remote_console_commands.threading', mock.MagicMock())
def test_HandleMessage_AutoCompleteListDone_ReadySet(self):
def test_HandleMessage_ConnectMessage_ReadySet(self):
rc_instance = remote_console.RemoteConsole()
rc_instance.on_display = mock.MagicMock()
rc_instance.ready = mock.MagicMock()
msg = b'70' # in python3 socket.recv returns byte array. 7 is AUTOCOMPLETELISTDONE
msg = b'I0' # in python3 socket.recv returns byte array. 7 is AUTOCOMPLETELISTDONE
rc_instance._handle_message(msg)