Пример #1
0
    def test_safe_setup(self, ckan_config):
        delimiter = Key().ckan.template_title_delimiter
        decl = Declaration()

        assert delimiter not in ckan_config
        decl.setup()
        decl.make_safe(ckan_config)
        assert delimiter in ckan_config
Пример #2
0
    def test_make_safe_in_safe_mode(self):
        decl = Declaration()
        decl.declare(Key().a, 10)

        cfg = CKANConfig({"config.mode": "strict"})
        assert decl.make_safe(cfg)
        assert cfg == CKANConfig({"config.mode": "strict", "a": 10})
Пример #3
0
    def test_make_safe_no_overrides(self):
        decl = Declaration()
        decl.declare(Key().a, 10)

        cfg = CKANConfig({"config.mode": "strict", "a": 20})
        assert decl.make_safe(cfg)
        assert cfg == CKANConfig({"config.mode": "strict", "a": 20})
Пример #4
0
    def test_make_safe_no_effect(self):
        decl = Declaration()
        decl.declare(Key().a, 10)

        cfg = CKANConfig()
        assert not decl.make_safe(cfg)
        assert cfg == CKANConfig()