Merge "Test: make enforce_type=True in CONF.set_override and fix error"

This commit is contained in:
Jenkins
2016-01-14 07:59:00 +00:00
committed by Gerrit Code Review
16 changed files with 41 additions and 26 deletions

View File

@@ -47,9 +47,11 @@ class FunctionalTest(base.DbTestCase):
def setUp(self):
super(FunctionalTest, self).setUp()
cfg.CONF.set_override("auth_version", "v2.0",
group='keystone_authtoken')
group='keystone_authtoken',
enforce_type=True)
cfg.CONF.set_override("admin_user", "admin",
group='keystone_authtoken')
group='keystone_authtoken',
enforce_type=True)
self.app = self._make_app()
def reset_pecan():

View File

@@ -120,7 +120,7 @@ class TestNoExceptionTracebackHook(api_base.FunctionalTest):
self.assertEqual(msg, actual_msg)
def test_hook_server_debug_on_serverfault(self):
cfg.CONF.set_override('debug', True)
cfg.CONF.set_override('debug', True, enforce_type=True)
self.root_convert_mock.side_effect = Exception(self.MSG_WITH_TRACE)
response = self.get_json('/', path_prefix='', expect_errors=True)
@@ -130,7 +130,7 @@ class TestNoExceptionTracebackHook(api_base.FunctionalTest):
self.assertEqual(self.MSG_WITHOUT_TRACE, actual_msg)
def test_hook_server_debug_on_clientfault(self):
cfg.CONF.set_override('debug', True)
cfg.CONF.set_override('debug', True, enforce_type=True)
client_error = Exception(self.MSG_WITH_TRACE)
client_error.code = 400
self.root_convert_mock.side_effect = client_error

View File

@@ -41,7 +41,8 @@ class TestApiUtilsValidScenarios(base.TestCase):
]
def test_validate_limit(self):
cfg.CONF.set_override("max_limit", self.max_limit, group="api")
cfg.CONF.set_override("max_limit", self.max_limit, group="api",
enforce_type=True)
actual_limit = v1_utils.validate_limit(self.limit)
self.assertEqual(actual_limit, self.expected)
@@ -53,7 +54,8 @@ class TestApiUtilsInvalidScenarios(base.TestCase):
]
def test_validate_limit_invalid_cases(self):
cfg.CONF.set_override("max_limit", self.max_limit, group="api")
cfg.CONF.set_override("max_limit", self.max_limit, group="api",
enforce_type=True)
self.assertRaises(
wsme.exc.ClientSideError, v1_utils.validate_limit, self.limit
)

View File

@@ -407,7 +407,8 @@ class TestListAction(api_base.FunctionalTest):
self.assertIn(next_marker, response['next'])
def test_collection_links_default_limit(self):
cfg.CONF.set_override('max_limit', 3, 'api')
cfg.CONF.set_override('max_limit', 3, 'api',
enforce_type=True)
for id_ in range(5):
obj_utils.create_test_action(self.context, id=id_,
uuid=utils.generate_uuid())

View File

@@ -267,7 +267,8 @@ class TestListActionPlan(api_base.FunctionalTest):
self.assertIn(next_marker, response['next'])
def test_collection_links_default_limit(self):
cfg.CONF.set_override('max_limit', 3, 'api')
cfg.CONF.set_override('max_limit', 3, 'api',
enforce_type=True)
for id_ in range(5):
obj_utils.create_action_plan_without_audit(
self.context, id=id_, uuid=utils.generate_uuid(),

View File

@@ -195,7 +195,8 @@ class TestListAuditTemplate(api_base.FunctionalTest):
self.assertIn(next_marker, response['next'])
def test_collection_links_default_limit(self):
cfg.CONF.set_override('max_limit', 3, 'api')
cfg.CONF.set_override('max_limit', 3, 'api',
enforce_type=True)
for id_ in range(5):
obj_utils.create_test_audit_template(
self.context, id=id_, uuid=utils.generate_uuid(),

View File

@@ -204,7 +204,8 @@ class TestListAudit(api_base.FunctionalTest):
self.assertIn(next_marker, response['next'])
def test_collection_links_default_limit(self):
cfg.CONF.set_override('max_limit', 3, 'api')
cfg.CONF.set_override('max_limit', 3, 'api',
enforce_type=True)
for id_ in range(5):
obj_utils.create_test_audit(self.context, id=id_,
uuid=utils.generate_uuid())

View File

@@ -26,7 +26,7 @@ class TestListGoal(api_base.FunctionalTest):
"DUMMY_1": "dummy", "DUMMY_2": "dummy",
"DUMMY_3": "dummy", "DUMMY_4": "dummy",
},
group='watcher_goals')
group='watcher_goals', enforce_type=True)
def _assert_goal_fields(self, goal):
goal_fields = ['name', 'strategy']
@@ -65,6 +65,6 @@ class TestListGoal(api_base.FunctionalTest):
self.assertEqual(2, len(response['goals']))
def test_goals_collection_links_default_limit(self):
cfg.CONF.set_override('max_limit', 3, 'api')
cfg.CONF.set_override('max_limit', 3, 'api', enforce_type=True)
response = self.get_json('/goals')
self.assertEqual(3, len(response['goals']))