[fuel] Skip test_server_basic_ops tempest test
[functest.git] / functest / tests / unit / core / test_vnf_base.py
1 #!/usr/bin/env python
2
3 # Copyright (c) 2016 Orange and others.
4 #
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
9
10 import logging
11 import mock
12 import unittest
13
14 from functest.core import vnf_base
15 from functest.core import testcase_base
16
17
18 class VnfBaseTesting(unittest.TestCase):
19
20     logging.disable(logging.CRITICAL)
21
22     def setUp(self):
23         self.test = vnf_base.VnfOnBoardingBase(project='functest',
24                                                case='aaa')
25         self.test.project = "functest"
26         self.test.case_name = "aaa"
27         self.test.start_time = "1"
28         self.test.stop_time = "5"
29         self.test.criteria = ""
30         self.test.details = {"orchestrator": {"status": "PASS",
31                                               "result": "",
32                                               "duration": 20},
33                              "vnf": {"status": "PASS",
34                                      "result": "",
35                                      "duration": 15},
36                              "test_vnf": {"status": "FAIL",
37                                           "result": "",
38                                           "duration": 5}}
39
40     @mock.patch('logging.Logger.error')
41     def test_deploy_vnf_unimplemented(self, mock):
42         self.assertEqual(self.test.deploy_vnf(),
43                          testcase_base.TestcaseBase.EX_TESTCASE_FAILED)
44         mock.assert_called_with('VNF must be deployed')
45
46     @mock.patch('logging.Logger.error')
47     def test_test_vnf_unimplemented(self, mock):
48         self.assertEqual(self.test.test_vnf(),
49                          testcase_base.TestcaseBase.EX_TESTCASE_FAILED)
50         mock.assert_called_with('VNF must be tested')
51
52     def test_parse_results(self):
53         self.assertNotEqual(self.test.parse_results(), 0)
54
55
56 if __name__ == "__main__":
57     unittest.main(verbosity=2)