From 0daef4c4c9581aeb41f7766423097df94d4d2b2b Mon Sep 17 00:00:00 2001 From: Martin Magr Date: Tue, 18 Jun 2013 15:02:44 +0200 Subject: [PATCH] Refactor patch 1 Moved setup_params to core.parameters Change-Id: I5485b448294017eb67969b40a5875b0bae2adb2f --- .../{setup_params.py => core/parameters.py} | 2 +- packstack/installer/setup_controller.py | 2 +- tests/installer/test_setup_params.py | 17 +++++++++++------ 3 files changed, 13 insertions(+), 8 deletions(-) rename packstack/installer/{setup_params.py => core/parameters.py} (97%) diff --git a/packstack/installer/setup_params.py b/packstack/installer/core/parameters.py similarity index 97% rename from packstack/installer/setup_params.py rename to packstack/installer/core/parameters.py index b2a8a8079..5636c1690 100644 --- a/packstack/installer/setup_params.py +++ b/packstack/installer/core/parameters.py @@ -4,7 +4,7 @@ Container set for groups and parameters """ -from .utils.datastructures import SortedDict +from ..utils.datastructures import SortedDict class Parameter(object): diff --git a/packstack/installer/setup_controller.py b/packstack/installer/setup_controller.py index 42c3a1f2d..c97e9a9a2 100644 --- a/packstack/installer/setup_controller.py +++ b/packstack/installer/setup_controller.py @@ -2,7 +2,7 @@ Controller class is a SINGLETON which handles all groups, params, sequences, steps and replaces the CONF dictionary. """ -from setup_params import Group +from .core.parameters import Group from .core.sequences import Sequence diff --git a/tests/installer/test_setup_params.py b/tests/installer/test_setup_params.py index 8d7accf9a..f8ffaf139 100644 --- a/tests/installer/test_setup_params.py +++ b/tests/installer/test_setup_params.py @@ -16,13 +16,13 @@ # under the License. """ -Test cases for packstack.installer.setup_params module. +Test cases for packstack.installer.core.parameters module. """ from unittest import TestCase from ..test_base import PackstackTestCaseMixin -from packstack.installer.setup_params import * +from packstack.installer.core.parameters import * class ParameterTestCase(PackstackTestCaseMixin, TestCase): @@ -45,7 +45,8 @@ class ParameterTestCase(PackstackTestCaseMixin, TestCase): def test_parameter_init(self): """ - Test packstack.installer.setup_params.Parameter initialization + Test packstack.installer.core.parameters.Parameter + initialization """ param = Parameter(self.data) for key, value in self.data.iteritems(): @@ -53,7 +54,7 @@ class ParameterTestCase(PackstackTestCaseMixin, TestCase): def test_default_attribute(self): """ - Test packstack.installer.setup_params.Parameter default value + Test packstack.installer.core.parameters.Parameter default value """ param = Parameter() self.assertIsNone(param.PROCESSORS) @@ -75,7 +76,9 @@ class GroupTestCase(PackstackTestCaseMixin, TestCase): {"CONF_NAME": "CONFIG_MYSQL_PW"}] 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) for key, value in self.attrs.iteritems(): self.assertEqual(getattr(group, key), value) @@ -83,7 +86,9 @@ class GroupTestCase(PackstackTestCaseMixin, TestCase): self.assertIn(param['CONF_NAME'], group.parameters) 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) param_list = group.search('PROMPT', 'find_me') self.assertEqual(len(param_list), 1)