コード例 #1
0
ファイル: tests.py プロジェクト: joonhwan/Centroid
    def test_all_environment_is_not_case_sensitive(self):
        config = Config('{"Prod": {"Shared": "production!"}, "All": {"Shared": "none", "AllOnly": "works"}}')
        config = config.for_environment("Prod")
        self.assertEqual(config.all_only, "works")

        config = Config('{"Prod": {"Shared": "production!"}, "all": {"Shared": "none", "AllOnly": "works"}}')
        config = config.for_environment("Prod")
        self.assertEqual(config.all_only, "works")
コード例 #2
0
    def test_all_environment_is_not_case_sensitive(self):
        config = Config(
            '{"Prod": {"Shared": "production!"}, "All": {"Shared": "none", "AllOnly": "works"}}'
        )
        config = config.for_environment("Prod")
        self.assertEqual(config.all_only, "works")

        config = Config(
            '{"Prod": {"Shared": "production!"}, "all": {"Shared": "none", "AllOnly": "works"}}'
        )
        config = config.for_environment("Prod")
        self.assertEqual(config.all_only, "works")
コード例 #3
0
 def test_supports_deep_merge(self):
     config = Config(
         '{"Prod": {"Database": {"Server": "prod-sql"}}, "All": {"Database": {"MigrationsPath": "path/to/migrations"}}}'
     )
     config = config.for_environment("Prod")
     self.assertEqual(config.database.server, "prod-sql")
     self.assertEqual(config.database.migrations_path, "path/to/migrations")
コード例 #4
0
ファイル: tests.py プロジェクト: ResourceDataInc/Centroid
    def test_supports_merge_override(self):
        json = """
        {
            "Dev": {
                "Connection": {
                    "server": "dev-server",
                    "database": "dev_database",
                    "SdeConnectionFile": "DEV:sde(file)"
                }
            },
            "All": {
                "Connection": {
                    "server": "",
                    "database": "",
                    "instance": "",
                    "user": "******",
                    "password": "******",
                    "version": "",
                    "SdeConnectionFile": ""
                }
            }
        }"""

        config = Config(json)
        config = config.for_environment("Dev")
        self.assertEqual(config.Connection.Server, "dev-server")
        self.assertEqual(config.Connection.database, "dev_database")
        self.assertEqual(config.Connection.instance, "")
        self.assertEqual(config.Connection.user, "default-user")
        self.assertEqual(config.Connection.password, "default-password")
        self.assertEqual(config.Connection.version, "")
        self.assertEqual(config.Connection.SdeConnectionFile, "DEV:sde(file)")
コード例 #5
0
 def test_environment_specific_config_overrides_all(self):
     config = Config(
         '{"Prod": {"Shared": "production!"}, "All": {"Shared": "none"}}')
     config = config.for_environment("Prod")
     self.assertEqual(config.shared, "production!")
コード例 #6
0
 def test_environment_specific_config_is_included(self):
     config = Config(self._json_config)
     environment_config = config.for_environment("theEnvironment")
     self.assertEqual(environment_config.the_key, "TheValue")
コード例 #7
0
 def test_environment_property_is_included(self):
     config = Config(self._json_config)
     environment_config = config.for_environment("theEnvironment")
     self.assertEqual(environment_config.environment, "theEnvironment")
コード例 #8
0
ファイル: tests.py プロジェクト: joonhwan/Centroid
 def test_environment_specific_config_overrides_all(self):
     config = Config('{"Prod": {"Shared": "production!"}, "All": {"Shared": "none"}}')
     config = config.for_environment("Prod")
     self.assertEqual(config.shared, "production!")
コード例 #9
0
ファイル: tests.py プロジェクト: joonhwan/Centroid
 def test_environment_specific_config_is_included(self):
     config = Config(self._json_config)
     environment_config = config.for_environment("theEnvironment")
     self.assertEqual(environment_config.the_key, "TheValue")
コード例 #10
0
ファイル: tests.py プロジェクト: joonhwan/Centroid
 def test_environment_property_is_included(self):
     config = Config(self._json_config)
     environment_config = config.for_environment("theEnvironment")
     self.assertEqual(environment_config.environment, "theEnvironment")
コード例 #11
0
ファイル: tests.py プロジェクト: joonhwan/Centroid
 def test_supports_deep_merge(self):
     config = Config('{"Prod": {"Database": {"Server": "prod-sql"}}, "All": {"Database": {"MigrationsPath": "path/to/migrations"}}}')
     config = config.for_environment("Prod")
     self.assertEqual(config.database.server, "prod-sql")
     self.assertEqual(config.database.migrations_path, "path/to/migrations")
コード例 #12
0
ファイル: tests.py プロジェクト: ResourceDataInc/Centroid
 def test_environment_specific_config_no_environment_property_if_has_environment_config_json(self):
     config = Config('{"Prod": {"Environment": "production!"}, "All": {"Shared": "none"}}')
     config = config.for_environment("Prod")
     self.assertEqual(config.environment, "production!")