コード例 #1
0
    def test_init_no_values(self):
        yaml = YamlConfigurationFile()
        self.assertIsNotNone(yaml)
        yaml.load_from_text("""
        rest:
        """, ConsoleConfiguration(), ".")

        sanic_config = SanicRestConfiguration("rest")
        sanic_config.load_configuration(yaml, ".")

        self.assertEqual("0.0.0.0", sanic_config.host)
        self.assertEqual(80, sanic_config.port)
        self.assertEqual(False, sanic_config.debug)
        self.assertEqual(False, sanic_config.use_api_keys)
コード例 #2
0
ファイル: test_config.py プロジェクト: frdino131/RyanCBT
    def test_init(self):
        yaml = YamlConfigurationFile()
        self.assertIsNotNone(yaml)
        yaml.load_from_text("""
        rest:
          host: 127.0.0.1
          port: 5000
          debug: false
          workers: 4
          use_api_keys: false
          api_key_file: apikeys.txt
        """, ConsoleConfiguration(), ".")

        sanic_config = SanicRestConfiguration("rest")
        sanic_config.load_configuration(yaml, ".")

        self.assertEqual("127.0.0.1", sanic_config.host)
        self.assertEqual(5000, sanic_config.port)
        self.assertEqual(False, sanic_config.debug)
        self.assertEqual(False, sanic_config.use_api_keys)
        self.assertEqual("apikeys.txt", sanic_config.api_key_file)

        self.assertEquals(4, sanic_config.workers)