summaryrefslogtreecommitdiff
path: root/tests/test_cfg.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-01-11 21:57:30 +0000
committerGerrit Code Review <review@openstack.org>2014-01-11 21:57:30 +0000
commit0c3a6431bbceff7234aad42c92b89e63c137a096 (patch)
tree844701c136ffe3e784811233f181dab9d3ba04f7 /tests/test_cfg.py
parent9972082433e594a61df70a18609380c509c43cbe (diff)
parent6c3883918d71888c07759c09eff3c8c3fb8ef456 (diff)
downloadoslo-config-0c3a6431bbceff7234aad42c92b89e63c137a096.tar.gz
Merge "Fix for parsing error with Dollar Sign ($) in values"
Diffstat (limited to 'tests/test_cfg.py')
-rw-r--r--tests/test_cfg.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_cfg.py b/tests/test_cfg.py
index 9716fa2..8fa5f19 100644
--- a/tests/test_cfg.py
+++ b/tests/test_cfg.py
@@ -1756,6 +1756,30 @@ class TemplateSubstitutionTestCase(BaseTestCase):
self._assert_str_sub()
+ def test_str_sub_with_dollar_escape_char(self):
+ self._prep_test_str_sub()
+
+ paths = self.create_tempfiles([('test',
+ '[DEFAULT]\n'
+ 'bar=foo-somethin$$k2\n')])
+
+ self.conf(['--config-file', paths[0]])
+
+ self.assertTrue(hasattr(self.conf, 'bar'))
+ self.assertEqual(self.conf.bar, 'foo-somethin$k2')
+
+ def test_str_sub_with_backslash_escape_char(self):
+ self._prep_test_str_sub()
+
+ paths = self.create_tempfiles([('test',
+ '[DEFAULT]\n'
+ 'bar=foo-somethin\$k2\n')])
+
+ self.conf(['--config-file', paths[0]])
+
+ self.assertTrue(hasattr(self.conf, 'bar'))
+ self.assertEqual(self.conf.bar, 'foo-somethin$k2')
+
def test_str_sub_group_from_default(self):
self.conf.register_cli_opt(cfg.StrOpt('foo', default='blaa'))
self.conf.register_group(cfg.OptGroup('ba'))