Add case_name as constructor arg
[functest.git] / functest / tests / unit / core / test_vnf_base.py
index 25a74b7..9670604 100644 (file)
@@ -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):
@@ -21,9 +19,8 @@ class VnfBaseTesting(unittest.TestCase):
 
     def setUp(self):
         self.test = vnf_base.VnfOnBoardingBase(project='functest',
-                                               case='aaa')
+                                               case_name='aaa')
         self.test.project = "functest"
-        self.test.case_name = "aaa"
         self.test.start_time = "1"
         self.test.stop_time = "5"
         self.test.criteria = ""
@@ -37,17 +34,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)