From 1322601c883763eef0784919c6d6c9aaac19ab97 Mon Sep 17 00:00:00 2001 From: Zhihai Song Date: Thu, 7 Jan 2016 15:27:33 +0800 Subject: test: pass enforce_type=True when using CONF.set_override CONF.set_override is used to change config option's value with designated value in unit test, but never check if the designated vaule is valid. Each config option has specifications for type and value. In production code, oslo.conf can ensure user's input is valid, but in unit test, test methods can pass if we use method CONF.set_override without parameter enforce_type=True even we pass wrong type or wrong value to config option. This commit makes sure calling method CONF.set_override with enforce_type=True in the unit test. Note: We can't set enforce_type=True by default in oslo.config now, it may break all project's unit test. We can switch enforce_type=True by default when all project fix violations like this commit. Change-Id: Id7170d565a99c45247d09142672ca6b32edd4012 --- oslo_middleware/tests/test_ssl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oslo_middleware/tests/test_ssl.py b/oslo_middleware/tests/test_ssl.py index 810503d..e493a3a 100644 --- a/oslo_middleware/tests/test_ssl.py +++ b/oslo_middleware/tests/test_ssl.py @@ -31,7 +31,7 @@ class SSLMiddlewareTest(base.BaseTestCase): if secure_proxy_ssl_header: middleware.oslo_conf.set_override( 'secure_proxy_ssl_header', secure_proxy_ssl_header, - group='oslo_middleware') + group='oslo_middleware', enforce_type=True) request = webob.Request.blank('http://example.com/', headers=headers) # Ensure ssl middleware does not stop pipeline execution -- cgit v1.2.1