aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests
diff options
context:
space:
mode:
authorJose Lausuch <jose.lausuch@ericsson.com>2017-06-26 09:14:35 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-06-26 09:14:35 +0000
commit48db3a575a737f957706f58ebdfc1851c3226b63 (patch)
tree12dac53b2f1e727ef1dd20df35cf62f852743583 /functest/tests
parent063c8af074a70b0b99c5c90c56d1fef541354192 (diff)
parente900266978e7f02c1999d1095c9d1468d05ea904 (diff)
Merge "Define logger as Feature instance attribute"
Diffstat (limited to 'functest/tests')
-rw-r--r--functest/tests/unit/core/test_feature.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/functest/tests/unit/core/test_feature.py b/functest/tests/unit/core/test_feature.py
index 0160c8e1..988981ef 100644
--- a/functest/tests/unit/core/test_feature.py
+++ b/functest/tests/unit/core/test_feature.py
@@ -38,12 +38,26 @@ class FeatureTestingBase(unittest.TestCase):
self.assertEqual(self.feature.start_time, 1)
self.assertEqual(self.feature.stop_time, 2)
+ def test_logger_module_ko(self):
+ with mock.patch('six.moves.builtins.open'):
+ self.feature = feature.Feature(
+ project_name=self._project_name, case_name=self._case_name)
+ self.assertEqual(self.feature.logger.name, self._case_name)
+
+ def test_logger_module(self):
+ with mock.patch('six.moves.builtins.open'):
+ self.feature = feature.Feature(
+ project_name=self._project_name, case_name=self._case_name,
+ run={'module': 'bar'})
+ self.assertEqual(self.feature.logger.name, 'bar')
+
class FeatureTesting(FeatureTestingBase):
def setUp(self):
- self.feature = feature.Feature(
- project_name=self._project_name, case_name=self._case_name)
+ with mock.patch('six.moves.builtins.open'):
+ self.feature = feature.Feature(
+ project_name=self._project_name, case_name=self._case_name)
def test_run_exc(self):
# pylint: disable=bad-continuation
@@ -60,8 +74,9 @@ class FeatureTesting(FeatureTestingBase):
class BashFeatureTesting(FeatureTestingBase):
def setUp(self):
- self.feature = feature.BashFeature(
- project_name=self._project_name, case_name=self._case_name)
+ with mock.patch('six.moves.builtins.open'):
+ self.feature = feature.BashFeature(
+ project_name=self._project_name, case_name=self._case_name)
@mock.patch("functest.utils.functest_utils.execute_command")
def test_run_no_cmd(self, mock_method=None):