示例#1
0
    def test_show_version(self):
        output = StringIO()
        settings = Settings("127.0.0.1", 5000, output, Action.SHOW_VERSION)
        cli = CLI(settings, output)

        cli.show_version()

        expected = TextPrinter.ABOUT.format(version=__VERSION__,
                                            code_license=__LICENSE__,
                                            service=__SERVICE_NAME__)
        self.assertEqual(expected, output.getvalue())
示例#2
0
 def test_parsing_log_file_name_short_format(self):
     log_file = "my_log_file.log"
     settings = Settings.from_command_line(["-l", log_file])
     self.assertEqual(log_file, settings.log_file)
示例#3
0
 def test_default_log_file_name(self):
     settings = Settings.from_command_line([])
     self.assertEqual(Settings.DEFAULT_LOG_FILE, settings.log_file)
示例#4
0
 def test_parsing_port_number_short_format(self):
     port = "1234"
     settings = Settings.from_command_line(["-p", port])
     self.assertEqual(int(port), settings.port)
示例#5
0
 def test_default_port_number(self):
     settings = Settings.from_command_line([])
     self.assertEqual(int(Settings.DEFAULT_PORT), settings.port)
示例#6
0
 def test_default_hostname_short_format(self):
     hostname = "127.0.0.1"
     settings = Settings.from_command_line(["-n", hostname])
     self.assertEquals(hostname, settings.hostname)
示例#7
0
 def test_default_hostname(self):
     settings = Settings.from_command_line([])
     self.assertEquals(Settings.DEFAULT_HOSTNAME, settings.hostname)
示例#8
0
 def test_show_version_short_format(self):
     settings = Settings.from_command_line(["-v"])
     self.assertEqual(Action.SHOW_VERSION, settings.action)
示例#9
0
 def test_default_action(self):
     settings = Settings.from_command_line([])
     self.assertEqual(Action.START, settings.action)