Exemplo n.º 1
0
    def test_init_no_values(self):
        yaml = YamlConfigurationFile()
        self.assertIsNotNone(yaml)
        yaml.load_from_text("""
        rest:
        """, ConsoleConfiguration(), ".")

        rest_config = RestConfiguration()
        rest_config.load_configuration(yaml, ".")

        self.assertEqual("0.0.0.0", rest_config.host)
        self.assertEqual(80, rest_config.port)
        self.assertEqual(False, rest_config.debug)
        self.assertEqual(4, rest_config.workers)
        self.assertEqual(False, rest_config.use_api_keys)
Exemplo n.º 2
0
    def test_init(self):
        yaml = YamlConfigurationFile()
        self.assertIsNotNone(yaml)
        yaml.load_from_text(
            """
        rest:
          host: 127.0.0.1
          port: 5000
          debug: false
          use_api_keys: false
        """, ConsoleConfiguration(), ".")

        rest_config = RestConfiguration()
        rest_config.load_config_section(yaml, ".")

        self.assertEqual("127.0.0.1", rest_config.host)
        self.assertEqual(5000, rest_config.port)
        self.assertEqual(False, rest_config.debug)
        self.assertEqual(False, rest_config.use_api_keys)
Exemplo n.º 3
0
 def get_client_configuration(self):
     return RestConfiguration()