diff options
author | Ben Nemec <bnemec@redhat.com> | 2014-02-28 19:32:47 +0000 |
---|---|---|
committer | Ben Nemec <bnemec@redhat.com> | 2014-02-28 19:40:58 +0000 |
commit | 08e54020d9c735ee7dfba9c1748892086cd73469 (patch) | |
tree | 1e1d7ff273599c4f7548a741782505ba0b8b49da /tests/test_cfg.py | |
parent | 53873a262c86bd24bac7c2fa3be5a6512d486ba1 (diff) | |
download | oslo-config-08e54020d9c735ee7dfba9c1748892086cd73469.tar.gz |
Do substitution on overrides and defaults too
Some of our consuming projects are setting defaults or overrides
on config objects that look like $state_path/some/file and we're
no longer handling that correctly since commit
2422d4118c97734067ea0b37ae159bc2e3c492c5
Change-Id: I4324bda6f3de3cdf05f8eb3cf16052c04018dec8
Closes-Bug: #1282250
Diffstat (limited to 'tests/test_cfg.py')
-rw-r--r-- | tests/test_cfg.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_cfg.py b/tests/test_cfg.py index 701f1e4..f1f576b 100644 --- a/tests/test_cfg.py +++ b/tests/test_cfg.py @@ -1793,6 +1793,24 @@ class TemplateSubstitutionTestCase(BaseTestCase): self.assertTrue(hasattr(self.conf.ba, 'r')) self.assertEqual(self.conf.ba.r, 'blaa') + def test_str_sub_set_default(self): + self._prep_test_str_sub() + self.conf.set_default('bar', '$foo') + self.conf.set_default('foo', 'blaa') + + self.conf([]) + + self._assert_str_sub() + + def test_str_sub_set_override(self): + self._prep_test_str_sub() + self.conf.set_override('bar', '$foo') + self.conf.set_override('foo', 'blaa') + + self.conf([]) + + self._assert_str_sub() + def _prep_test_str_int_sub(self, foo_default=None, bar_default=None): self.conf.register_cli_opt(cfg.StrOpt('foo', default=foo_default)) self.conf.register_cli_opt(cfg.IntOpt('bar', default=bar_default)) |