From 24f21f5b557a5b28aa57afdc92387514464eda1c Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Wed, 9 Jan 2013 13:34:35 -0500 Subject: Fix issue in test_forbidden_action_exposure. Updates the test_forbidden_action_exposure in test_exception.py so that it no longer tries to raise an incorrectly formed ForbiddenAction exception when CONF.debug = False. ForbiddenAction exception *should* have all kwargs specified even if a message is set because in non-debug mode only exception formatting gets used. Previously this test would pass because exception.py handled all exception format errors. While handling exception formatting errors is Okay at runtime ideally we want to check for them when running tests. This commit also enhances the test_forbidden_action_exposure so that it checks for the existence of the 'action' in the exception message... where the 'message' should be absent. Change-Id: I47d16405254c14655c64e4587530c29ba15ab80c --- tests/test_exception.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/test_exception.py b/tests/test_exception.py index eb67098b..ae036ef2 100644 --- a/tests/test_exception.py +++ b/tests/test_exception.py @@ -114,10 +114,11 @@ class SecurityErrorTestCase(ExceptionTestCase): CONF.debug = False risky_info = uuid.uuid4().hex - - e = exception.ForbiddenAction(message=risky_info) + action = uuid.uuid4().hex + e = exception.ForbiddenAction(message=risky_info, action=action) self.assertValidJsonRendering(e) self.assertNotIn(risky_info, str(e)) + self.assertIn(action, str(e)) e = exception.ForbiddenAction(action=risky_info) self.assertValidJsonRendering(e) -- cgit