Added 'dummy' entrypoint within watcher_strategies

This should make our 'dummy' strategy available for use.
I also removed all previously defined default goals, which means
that they will have to define it themselves from now on.
This can also be useful for future integration tests.

Change-Id: I6c43eba941022a88851a199b56a6c20f017b9e71
DocImpact
Closes-Bug: #1520178
This commit is contained in:
Vincent Françoise
2015-11-26 14:16:18 +01:00
committed by David TARDIVEL
parent a809b8d52c
commit 9078e1e138
10 changed files with 73 additions and 61 deletions

View File

@@ -379,7 +379,7 @@ class TestPost(api_base.FunctionalTest):
wraps=self.dbapi.create_audit_template
) as cn_mock:
audit_template_dict = api_utils.audit_template_post_data(
goal='SERVERS_CONSOLIDATION')
goal='DUMMY')
response = self.post_json('/audit_templates', audit_template_dict)
self.assertEqual(audit_template_dict['goal'],
response.json['goal'])

View File

@@ -20,6 +20,13 @@ class TestListGoal(api_base.FunctionalTest):
def setUp(self):
super(TestListGoal, self).setUp()
# Override the default to get enough goals to test limit on query
cfg.CONF.set_override(
"goals", {
"DUMMY_1": "dummy", "DUMMY_2": "dummy",
"DUMMY_3": "dummy", "DUMMY_4": "dummy",
},
group='watcher_goals')
def _assert_goal_fields(self, goal):
goal_fields = ['name', 'strategy']
@@ -53,11 +60,11 @@ class TestListGoal(api_base.FunctionalTest):
self.assertEqual(len(CONF.watcher_goals.goals),
len(response['goals']))
def test_collection_links(self):
def test_goals_collection_links(self):
response = self.get_json('/goals/?limit=2')
self.assertEqual(2, len(response['goals']))
def test_collection_links_default_limit(self):
def test_goals_collection_links_default_limit(self):
cfg.CONF.set_override('max_limit', 3, 'api')
response = self.get_json('/goals')
self.assertEqual(3, len(response['goals']))