aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit/ci/test_tier_builder.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-01-21 01:02:20 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2018-01-21 14:53:47 +0100
commit2030e14451a072844e750318de0d5efc47d4500c (patch)
tree47e79f3244d233d6edbe11e30150185ed12a59e0 /functest/tests/unit/ci/test_tier_builder.py
parenta6df43da7ab4de653eecbc9b6380d5fc7ce7bc14 (diff)
Fully test and cover functest/ci/tier_*
It also fixes check_deployment.py and ci unit tests which were wrong when testing exceptions. Now ci modules are rated 10/10 and fully covered. Change-Id: I30dca491b44cc54aa1abc0d0433c00b4dcabfdc4 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit/ci/test_tier_builder.py')
-rw-r--r--functest/tests/unit/ci/test_tier_builder.py41
1 files changed, 21 insertions, 20 deletions
diff --git a/functest/tests/unit/ci/test_tier_builder.py b/functest/tests/unit/ci/test_tier_builder.py
index d832ca3f..ef6a007b 100644
--- a/functest/tests/unit/ci/test_tier_builder.py
+++ b/functest/tests/unit/ci/test_tier_builder.py
@@ -18,23 +18,17 @@ from functest.ci import tier_builder
class TierBuilderTesting(unittest.TestCase):
def setUp(self):
- self.dependency = {'installer': 'test_installer',
- 'scenario': 'test_scenario'}
-
- self.testcase = {'dependencies': self.dependency,
- 'enabled': 'true',
- 'case_name': 'test_name',
- 'criteria': 'test_criteria',
- 'blocking': 'test_blocking',
- 'description': 'test_desc',
- 'project_name': 'project_name'}
-
- self.dic_tier = {'name': 'test_tier',
- 'order': 'test_order',
- 'ci_loop': 'test_ci_loop',
- 'description': 'test_desc',
- 'testcases': [self.testcase]}
-
+ self.dependency = {
+ 'installer': 'test_installer', 'scenario': 'test_scenario'}
+ self.testcase = {
+ 'dependencies': self.dependency, 'enabled': 'true',
+ 'case_name': 'test_name', 'criteria': 'test_criteria',
+ 'blocking': 'test_blocking', 'description': 'test_desc',
+ 'project_name': 'project_name'}
+ self.dic_tier = {
+ 'name': 'test_tier', 'order': 'test_order',
+ 'ci_loop': 'test_ci_loop', 'description': 'test_desc',
+ 'testcases': [self.testcase]}
self.mock_yaml = mock.Mock()
attrs = {'get.return_value': [self.dic_tier]}
self.mock_yaml.configure_mock(**attrs)
@@ -42,9 +36,8 @@ class TierBuilderTesting(unittest.TestCase):
with mock.patch('functest.ci.tier_builder.yaml.safe_load',
return_value=self.mock_yaml), \
mock.patch('six.moves.builtins.open', mock.mock_open()):
- self.tierbuilder = tier_builder.TierBuilder('test_installer',
- 'test_scenario',
- 'testcases_file')
+ self.tierbuilder = tier_builder.TierBuilder(
+ 'test_installer', 'test_scenario', 'testcases_file')
self.tier_obj = self.tierbuilder.tier_objects[0]
def test_get_tiers(self):
@@ -86,6 +79,14 @@ class TierBuilderTesting(unittest.TestCase):
def test_get_tier_name_ko(self):
self.assertEqual(self.tierbuilder.get_tier_name('test_name2'), None)
+ def test_str(self):
+ message = str(self.tierbuilder)
+ self.assertTrue('test_tier' in message)
+ self.assertTrue('test_order' in message)
+ self.assertTrue('test_ci_loop' in message)
+ self.assertTrue('test_desc' in message)
+ self.assertTrue('test_name' in message)
+
if __name__ == "__main__":
logging.disable(logging.CRITICAL)