Add extra test for name_check /info

Test that the actual configured options get reported in /info

Follow up to:
Related-Change: If1af43485b4708cab6c4b5d7f6f0a334d8752518

Change-Id: I1d76d40c70a38b959dd0103f3c56b1da4dae068f
This commit is contained in:
Alistair Coles 2017-03-21 10:59:50 +00:00
parent cd39778824
commit bd400dd22e

View File

@ -137,6 +137,18 @@ class TestSwiftInfo(unittest.TestCase):
swift_info['name_check'].get('forbidden_regexp'),
str))
def test_registered_configured_options(self):
conf = {'maximum_length': 512,
'forbidden_chars': '\'\"`',
'forbidden_regexp': "/\./|/\.\./|/\.$"}
name_check.filter_factory(conf)(FakeApp())
swift_info = utils.get_swift_info()
self.assertTrue('name_check' in swift_info)
self.assertEqual(swift_info['name_check'].get('maximum_length'), 512)
self.assertEqual(set(swift_info['name_check'].get('forbidden_chars')),
set('\'\"`'))
self.assertEqual(swift_info['name_check'].get('forbidden_regexp'),
"/\./|/\.\./|/\.$")
if __name__ == '__main__':
unittest.main()