Allow empty strings for raw and default types.
Empty string is a perfectly valid raw string and the default type is meant to prevent malicious characters, not empty strings. Change-Id: I717bbcfe1a81b383782122870d0d727b28f40cce
This commit is contained in:
parent
c56819ae40
commit
fa5fb2d163
|
@ -35,3 +35,11 @@ class ValueTypeTestCase(testtools.TestCase):
|
|||
def test_default_bad(self):
|
||||
self.assertRaises(config_exception.ConfigException,
|
||||
value_types.ensure_type, "foo\nbar", "default")
|
||||
|
||||
def test_default_empty(self):
|
||||
self.assertEqual('',
|
||||
value_types.ensure_type('', 'default'))
|
||||
|
||||
def test_raw_empty(self):
|
||||
self.assertEqual('',
|
||||
value_types.ensure_type('', 'raw'))
|
||||
|
|
|
@ -19,8 +19,8 @@ from config_exception import ConfigException
|
|||
|
||||
TYPES = {
|
||||
"int": "^[0-9]+$",
|
||||
"default": "^[A-Za-z0-9]+$",
|
||||
"raw": "."
|
||||
"default": "^[A-Za-z0-9]*$",
|
||||
"raw": ""
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue