From bd400dd22e9e401c9b24a598d5e292826bd16c69 Mon Sep 17 00:00:00 2001 From: Alistair Coles Date: Tue, 21 Mar 2017 10:59:50 +0000 Subject: [PATCH] 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 --- test/unit/common/middleware/test_name_check.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/unit/common/middleware/test_name_check.py b/test/unit/common/middleware/test_name_check.py index 644b348aff..eab187cc15 100644 --- a/test/unit/common/middleware/test_name_check.py +++ b/test/unit/common/middleware/test_name_check.py @@ -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()