Beispiel #1
0
def test__can_spawn_process_with_startup_command():
    try:
        command_handler = CommandHandler()
        command_handler.spawn_process('echo 1')
        assert command_handler is not None
    except Exception as ex:
        pytest.fail("error initialising CommandHandler: " + str(ex))
Beispiel #2
0
def test__can_run_command_and_set_test_buffer_has_value():
    try:
        test_tide = Tide()
        command_handler = CommandHandler()
        command_handler.spawn_process()
        buffer_result = Config().get_internal_buffer_caches()
        test_tide.run_config_command('test_command')
        assert len(buffer_result["test_buffer"]) == 3
    except Exception as ex:
        pytest.fail("error initialising CommandHandler: " + str(ex))
Beispiel #3
0
def test__can_run_command_and_set_session_log_buffer():
    try:
        from tide.config.config import Config
        command_handler = CommandHandler()
        command_handler.spawn_process()
        result = command_handler.run_command("echo hi")
        buffer_result = Config().get_internal_buffer_caches()
        assert buffer_result.get("vg_session_log") is not None
    except Exception as ex:
        pytest.fail("error initialising CommandHandler: " + str(ex))
Beispiel #4
0
def test__can_run_command_and_return_lines():
    try:
        command_handler = CommandHandler()
        command_handler.spawn_process()
        result = command_handler.run_command("echo hi")
        assert result == [
            'echo hi\r', 'hi\r', '/work/tide/tests/pytest_tests # \x1b[6n'
        ]
    except Exception as ex:
        pytest.fail("error initialising CommandHandler: " + str(ex))
Beispiel #5
0
def test__can_run_command_and_set_test_buffer_has_value_of_line():
    try:
        test_tide = Tide()
        command_handler = CommandHandler()
        command_handler.spawn_process()
        buffer_result = Config().get_internal_buffer_caches()
        test_tide.run_config_command('test_command')
        assert buffer_result["test_buffer"][0] == 'echo "hello"\r'
        assert buffer_result["test_buffer"][1] == 'hello\r'
        assert buffer_result["test_buffer"][
            2] == '/work/tide/tests/pytest_tests # \x1b[6n'
    except Exception as ex:
        pytest.fail("error initialising CommandHandler: " + str(ex))
Beispiel #6
0
 def run(self, command_item, buffer_name=''):
     variable_name = command_item['variable_name']
     variable_value = Config().get_variable(variable_name)
     PTS.info("RUN_COMMAND_STRING", variable_name, buffer_name,
              command_item)
     if variable_value:
         return CommandHandler().run_command(variable_value, buffer_name)
     return None
Beispiel #7
0
 def run(self, command_item, buffer_name=''):
     buffer_name = buffer_name or command_item.get("buffer_name", '')
     command_value = command_item['command']
     interpolated_command_value = Interpolate.interpolate_variables(
         command_value)
     PTS.info("RUN_COMMAND", interpolated_command_value, buffer_name,
              command_item)
     return CommandHandler().run_command(interpolated_command_value,
                                         buffer_name)
 def run(self, command_item, buffer_name=''):
     PTS.info("RUN_COMMAND_WITH_MATCH", command_item["command"], buffer_name, command_item)
     self.__set_locals(command_item, buffer_name)
     self._lines = CommandHandler().run_command(self._command_item_command)
     if self._try_set_var:
         self.__get_match()
     if self._try_set_array_var:
         self.__get_array_match()
     self.__try_set_variable()
     PTS.info("*RUN_COMMAND_WITH_MATCH", str(command_item["command"]), str(buffer_name), "Match: '" + str(self._regex_match) + "', Var: '" + str(self._try_set_var) + "', Result: '" + str(self._match_result) + str(self._try_set_array_var) + "'")
 def run(self, command_item, buffer_name=''):
     PTS.info("RUN_COMMAND_WITH_MATCH_GROUP", command_item["command"],
              buffer_name, command_item)
     self.__set_locals(command_item, buffer_name)
     self._lines = CommandHandler().run_command(
         self._command_item["command"])
     temp_dict = {}
     for key, value in self._match_dictionary.items():
         temp_dict[key] = self.__get_match(value)
     self._match_dictionary.update(temp_dict)
     for key, value in self._match_dictionary.items():
         Config().set_variable(key, value["result"])
Beispiel #10
0
def test__can_run_command():
    try:
        command_handler = CommandHandler()
        command_handler.spawn_process()
        command_handler.run_command("test_command")
        assert command_handler is not None
    except Exception as ex:
        pytest.fail("error initialising CommandHandler: " + str(ex))