3 # Copyright (c) 2017 Orange and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # pylint: disable=missing-docstring
18 from functest.core import testcase
19 sys.modules['baro_tests'] = mock.Mock() # noqa
20 # pylint: disable=wrong-import-position
21 from functest.opnfv_tests.features import barometer
22 from functest.utils import constants
25 class BarometerTesting(unittest.TestCase):
27 logging.disable(logging.CRITICAL)
29 _case_name = "barometercollectd"
30 _project_name = "barometer"
33 self.barometer = barometer.BarometerCollectd(
34 case_name=self._case_name, project_name=self._project_name)
37 self.assertEqual(self.barometer.project_name, self._project_name)
38 self.assertEqual(self.barometer.case_name, self._case_name)
41 constants.CONST.__getattribute__('dir_repo_barometer'))
43 @unittest.skip("JIRA: FUNCTEST-777")
44 def test_execute_ko(self):
45 # It must be skipped to allow merging
46 sys.modules['baro_tests'].collectd.main = mock.Mock(return_value=1)
47 self.assertEqual(self.barometer.execute(),
48 testcase.TestCase.EX_RUN_ERROR)
50 @unittest.skip("JIRA: FUNCTEST-777")
51 def test_execute(self):
52 # It must be skipped to allow merging
53 sys.modules['baro_tests'].collectd.main = mock.Mock(return_value=0)
54 self.assertEqual(self.barometer.execute(), testcase.TestCase.EX_OK)
57 if __name__ == "__main__":
58 unittest.main(verbosity=2)