aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2017-03-10 16:14:29 +0100
committerMorgan Richomme <morgan.richomme@orange.com>2017-03-10 17:03:11 +0100
commit6ac6937237bc03b27935f71bbb33c0abffc1e993 (patch)
treeaf8e6e88da1d8bf16ce1d6ffac5ba2c85fb86e9b /functest/tests/unit
parent6587f877a3c6e2954d9e32a0652c6f0d1d356ab7 (diff)
Remove raise exceptions
until exceptions are better managed in abstraction Currently it triggers an exit from the jenkins job and prevent other tests to be run Change-Id: Id3b18c1d6d3b786fc78456b3ad51963d2cbb2cc1 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'functest/tests/unit')
-rw-r--r--functest/tests/unit/core/test_vnf_base.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/functest/tests/unit/core/test_vnf_base.py b/functest/tests/unit/core/test_vnf_base.py
index e27f2164..25a74b7c 100644
--- a/functest/tests/unit/core/test_vnf_base.py
+++ b/functest/tests/unit/core/test_vnf_base.py
@@ -8,9 +8,11 @@
# http://www.apache.org/licenses/LICENSE-2.0
import logging
+import mock
import unittest
from functest.core import vnf_base
+from functest.core import testcase_base
class VnfBaseTesting(unittest.TestCase):
@@ -35,18 +37,21 @@ class VnfBaseTesting(unittest.TestCase):
"result": "",
"duration": 5}}
- def test_deploy_vnf_unimplemented(self):
- with self.assertRaises(Exception) as context:
- self.test.deploy_vnf()
- self.assertTrue('VNF not deployed' in context.exception)
+ @mock.patch('logging.Logger.error')
+ def test_deploy_vnf_unimplemented(self, mock):
+ self.assertEqual(self.test.deploy_vnf(),
+ testcase_base.TestcaseBase.EX_TESTCASE_FAILED)
+ mock.assert_called_with('VNF must be deployed')
- def test_test_vnf_unimplemented(self):
- with self.assertRaises(Exception) as context:
- self.test.test_vnf()()
- self.assertTrue('VNF not tested' in context.exception)
+ @mock.patch('logging.Logger.error')
+ def test_test_vnf_unimplemented(self, mock):
+ self.assertEqual(self.test.test_vnf(),
+ testcase_base.TestcaseBase.EX_TESTCASE_FAILED)
+ mock.assert_called_with('VNF must be tested')
def test_parse_results(self):
self.assertNotEqual(self.test.parse_results(), 0)
+
if __name__ == "__main__":
unittest.main(verbosity=2)