aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit
diff options
context:
space:
mode:
authorboucherv <valentin.boucher@orange.com>2017-03-20 10:52:48 +0100
committerboucherv <valentin.boucher@orange.com>2017-03-20 10:52:48 +0100
commit3575dcb2a262c623dd4ded0823bc78adf3a1012e (patch)
tree900c271c143e40a36aa809a8f7ba7470a4d75094 /functest/tests/unit
parent875bae259b42bf178101574f3516f87b3708a533 (diff)
[vnf_base] improve exception
Return on part of previous changes in commit: 30257 https://gerrit.opnfv.org/gerrit/#/c/30257/ Change-Id: I11b33ee2a6f9d4cbcf1449006b47be508fce655e Signed-off-by: boucherv <valentin.boucher@orange.com>
Diffstat (limited to 'functest/tests/unit')
-rw-r--r--functest/tests/unit/core/test_vnf_base.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/functest/tests/unit/core/test_vnf_base.py b/functest/tests/unit/core/test_vnf_base.py
index 25a74b7c..1680f03f 100644
--- a/functest/tests/unit/core/test_vnf_base.py
+++ b/functest/tests/unit/core/test_vnf_base.py
@@ -8,11 +8,9 @@
# 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):
@@ -37,17 +35,15 @@ class VnfBaseTesting(unittest.TestCase):
"result": "",
"duration": 5}}
- @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')
-
- @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_deploy_vnf_unimplemented(self):
+ with self.assertRaises(Exception) as context:
+ self.test.deploy_vnf()
+ self.assertTrue('VNF not deployed' in context.exception)
+
+ def test_test_vnf_unimplemented(self):
+ with self.assertRaises(Exception) as context:
+ self.test.test_vnf()()
+ self.assertTrue('VNF not tested' in context.exception)
def test_parse_results(self):
self.assertNotEqual(self.test.parse_results(), 0)