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

@@ -32,7 +32,8 @@ class TestStrategySelector(TestCase):
@patch.object(DefaultStrategyLoader, 'load')
def test_define_from_goal(self, mock_call):
cfg.CONF.set_override('goals',
{"DUMMY": "fake"}, group='watcher_goals')
{"DUMMY": "fake"}, group='watcher_goals',
enforce_type=True)
expected_goal = 'DUMMY'
expected_strategy = CONF.watcher_goals.goals[expected_goal]
self.strategy_selector.define_from_goal(expected_goal)
@@ -40,7 +41,8 @@ class TestStrategySelector(TestCase):
@patch.object(DefaultStrategyLoader, 'load')
def test_define_from_goal_with_incorrect_mapping(self, mock_call):
cfg.CONF.set_override('goals', {}, group='watcher_goals')
cfg.CONF.set_override('goals', {}, group='watcher_goals',
enforce_type=True)
self.assertRaises(WatcherException,
self.strategy_selector.define_from_goal,
"DUMMY")