Mercurial > hgrepos > Python > libs > ConfigMix
diff tests/test.py @ 692:db764da37cd2
Add a test with a "real-world" config structure with regard to references and jails
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 11 Jun 2023 16:47:29 +0200 |
| parents | e71f8bd50342 |
| children | 57fe110c50c8 |
line wrap: on
line diff
--- a/tests/test.py Sat Jun 10 22:33:11 2023 +0200 +++ b/tests/test.py Sun Jun 11 16:47:29 2023 +0200 @@ -2022,6 +2022,20 @@ self.assertEqual("v6", jcfg2.getvarl_s("k6")) self.assertEqual("v3", jcfg2.getvarl_s("ks")) + def test_jails_and_refs_tree(self): + cfg = configmix.load(os.path.join( + TESTDATADIR, "jail-root-ref.yml")) + for flavour in ("access", "job"): + tokcfg = cfg.jailed(rootpath=("realworld", "token", flavour)) + self.assertEqual(-2, tokcfg.getintvar_s("nbf")) + for idx, keysetcfg in enumerate( + tokcfg.jailed(rootpath=("sign",)).iter_jailed()): + self.assertEqual("key-%d" % (idx+1,), + keysetcfg.getvarl_s("name")) + self.assertEqual("something%d" % (idx+1,), + keysetcfg.getvarl_s("type")) + self.assertIsNone(keysetcfg.getvarl_s("data")) + class _TParserMixin: def test_quote_and_unquote_empty(self):
