Пример #1
0
    def test_help_command_alias(self):
        sys.argv = ["file_name", "-h"]
        cli_entry_point()
        messages: str = escape_ansi(self.new_stdout.getvalue())

        self.assertIn(_DESCRIPTION_MESSAGE, messages)
        self.assertIn(_DESCRIPTION_CONTENT_MESSAGE, messages)

        self.assertIn(_PROGRAM_INFO_MESSAGE, messages)
        self.assertIn(_HELP_COMMAND_ARGUMENTS_MESSAGE, messages)
        self.assertIn(_HELP_COMMAND_DESCRIPTION_MESSAGE, messages)
        self.assertIn(_VERSION_COMMAND_ARGUMENTS_MESSAGE, messages)
        self.assertIn(_VERSION_COMMAND_DESCRIPTION_MESSAGE, messages)

        self.assertIn(_ARGUMENTS_MESSAGE, messages)
Пример #2
0
 def test_help_command_init_output(self):
     sys.argv = ["file_name", "-h"]
     cli_entry_point()
     messages: str = escape_ansi(self.new_stdout.getvalue())
     self.assertIn(
         "Creates a Python virtual environment based on the configuration",
         messages)
     self.assertIn(
         "of an existing 'caos.yml' file in the current directory.",
         messages)
     self.assertIn(
         "If the 'caos.yml' file is not present in the current directory a",
         messages)
     self.assertIn(
         "new virtual environment and configuration file are created.",
         messages)
     self.assertIn("caos init", messages)
     self.assertIn("caos init [VIRTUAL_ENV_NAME]", messages)
Пример #3
0
    def test_invalid_command_argument_missing(self):
        sys.argv = ["file_name"]
        cli_entry_point()
        messages: str = escape_ansi(self.new_stdout.getvalue())

        self.assertIn(_NO_ARG_MESSAGE, messages)
Пример #4
0
    def test_invalid_command_argument_unknown(self):
        sys.argv = ["file_name", "some_weird_invalid_argument"]
        cli_entry_point()
        messages: str = escape_ansi(self.new_stdout.getvalue())

        self.assertIn(_UNKNOWN_ARG, messages)
Пример #5
0
    def test_version_command_alias2(self):
        sys.argv = ["file_name", "-V"]
        cli_entry_point()
        messages: str = escape_ansi(self.new_stdout.getvalue())

        self.assertIn(_VERSION_MESSAGE, messages)
Пример #6
0
from caos._cli import cli_entry_point

if __name__ == '__main__':
    exit(cli_entry_point())