Refactor patch 1

Moved setup_params to core.parameters

Change-Id: I5485b448294017eb67969b40a5875b0bae2adb2f
This commit is contained in:
Martin Magr 2013-06-18 15:02:44 +02:00
parent 0718925e13
commit 0daef4c4c9
3 changed files with 13 additions and 8 deletions

View File

@ -4,7 +4,7 @@
Container set for groups and parameters Container set for groups and parameters
""" """
from .utils.datastructures import SortedDict from ..utils.datastructures import SortedDict
class Parameter(object): class Parameter(object):

View File

@ -2,7 +2,7 @@
Controller class is a SINGLETON which handles all groups, params, sequences, Controller class is a SINGLETON which handles all groups, params, sequences,
steps and replaces the CONF dictionary. steps and replaces the CONF dictionary.
""" """
from setup_params import Group from .core.parameters import Group
from .core.sequences import Sequence from .core.sequences import Sequence

View File

@ -16,13 +16,13 @@
# under the License. # under the License.
""" """
Test cases for packstack.installer.setup_params module. Test cases for packstack.installer.core.parameters module.
""" """
from unittest import TestCase from unittest import TestCase
from ..test_base import PackstackTestCaseMixin from ..test_base import PackstackTestCaseMixin
from packstack.installer.setup_params import * from packstack.installer.core.parameters import *
class ParameterTestCase(PackstackTestCaseMixin, TestCase): class ParameterTestCase(PackstackTestCaseMixin, TestCase):
@ -45,7 +45,8 @@ class ParameterTestCase(PackstackTestCaseMixin, TestCase):
def test_parameter_init(self): def test_parameter_init(self):
""" """
Test packstack.installer.setup_params.Parameter initialization Test packstack.installer.core.parameters.Parameter
initialization
""" """
param = Parameter(self.data) param = Parameter(self.data)
for key, value in self.data.iteritems(): for key, value in self.data.iteritems():
@ -53,7 +54,7 @@ class ParameterTestCase(PackstackTestCaseMixin, TestCase):
def test_default_attribute(self): def test_default_attribute(self):
""" """
Test packstack.installer.setup_params.Parameter default value Test packstack.installer.core.parameters.Parameter default value
""" """
param = Parameter() param = Parameter()
self.assertIsNone(param.PROCESSORS) self.assertIsNone(param.PROCESSORS)
@ -75,7 +76,9 @@ class GroupTestCase(PackstackTestCaseMixin, TestCase):
{"CONF_NAME": "CONFIG_MYSQL_PW"}] {"CONF_NAME": "CONFIG_MYSQL_PW"}]
def test_group_init(self): def test_group_init(self):
"""Test packstack.installer.setup_params.Group initialization""" """
Test packstack.installer.core.parameters.Group initialization
"""
group = Group(attributes=self.attrs, parameters=self.params) group = Group(attributes=self.attrs, parameters=self.params)
for key, value in self.attrs.iteritems(): for key, value in self.attrs.iteritems():
self.assertEqual(getattr(group, key), value) self.assertEqual(getattr(group, key), value)
@ -83,7 +86,9 @@ class GroupTestCase(PackstackTestCaseMixin, TestCase):
self.assertIn(param['CONF_NAME'], group.parameters) self.assertIn(param['CONF_NAME'], group.parameters)
def test_search(self): def test_search(self):
"""Test packstack.installer.setup_params.Group search method""" """
Test packstack.installer.core.parameters.Group search method
"""
group = Group(attributes=self.attrs, parameters=self.params) group = Group(attributes=self.attrs, parameters=self.params)
param_list = group.search('PROMPT', 'find_me') param_list = group.search('PROMPT', 'find_me')
self.assertEqual(len(param_list), 1) self.assertEqual(len(param_list), 1)