def test_install(self, my_clai_module): if self.is_auto_mode(): execute_cmd(my_clai_module, "clai auto") skill_name = self.get_skill_name() command_select = f"clai activate {skill_name}" command_executed = execute_cmd(my_clai_module, command_select) assert f"☑\x1b[32m {skill_name} (Installed)" in command_executed
def test_install_should_modify_correct_startup_files(my_clai): execute_cmd(my_clai, "sudo ./install.sh --unassisted --demo") files = my_clai.get_files('/root') bashrc_output = str(files['root/.bashrc']) bash_profile_output = str(files['root/.bash_profile']) assert "# CLAI setup" in bashrc_output assert "# CLAI setup" in bash_profile_output assert "# End CLAI setup" in bashrc_output assert "# End CLAI setup" in bash_profile_output
def test_install(self, my_clai_module): if self.is_auto_mode(): execute_cmd(my_clai_module, "clai auto") skill_name = self.get_skill_name() execute_cmd(my_clai_module, "clai deactivate gpt3") command_select = f"clai activate {skill_name}" command_executed = execute_cmd(my_clai_module, command_select) assert f"\x1b[32m {skill_name} (Installed)" in command_executed, \ f'Skill {skill_name} not found installed. Output: {command_executed}'
def test_uninstall_should_return_bash_files_to_previous_state(my_clai): files = my_clai.get_files('/root') bashrc_original = str(files['root/.bashrc']) bash_profile_original = str(files['root/.bash_profile']) execute_cmd(my_clai, "sudo ./install.sh --unassisted --demo") execute_cmd(my_clai, "sudo ./uninstall.sh") sleep(2) files = my_clai.get_files('/root') bashrc_after_uninstall = str(files['root/.bashrc']) bash_profile_after_uninstall = str(files['root/.bash_profile']) assert bashrc_after_uninstall == bashrc_original assert bash_profile_original == bash_profile_after_uninstall
def _send_to_emulator(self, command: str) -> str: response = execute_cmd(self.my_clai, command) return response
def request_skills(self): response = execute_cmd(self.my_clai, "clai skills") skills_as_string = response skills_as_array = skills_as_string.splitlines() self.on_skills_ready(skills_as_array[2:-1])
def test_skill_values(self, my_clai_module, command, command_expected): command_executed = execute_cmd(my_clai_module, command) assert command_expected in command_executed, \ f'Expected: {command_expected}, Received: {command_executed}'
def test_uninstall_should_return_the_correct_uninstall_message(my_clai): execute_cmd(my_clai, "sudo ./install.sh --unassisted --demo") uninstall_output = execute_cmd(my_clai, "sudo ./uninstall.sh") sleep(2) print(uninstall_output) assert UNINSTALL_CORRECTLY_MESSAGE in uninstall_output
def test_install_should_finish_correctly(my_clai): install_output = execute_cmd(my_clai, "sudo ./install.sh --unassisted --demo") assert INSTALL_CORRECTLY_MESSAGE in install_output