Merge "Update documentation for Danube"
[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 unittest
12
13 from functest.core import vnf_base
14
15
16 class VnfBaseTesting(unittest.TestCase):
17
18     logging.disable(logging.CRITICAL)
19
20     def setUp(self):
21         self.test = vnf_base.VnfOnBoardingBase(project='functest',
22                                                case='aaa')
23         self.test.project = "functest"
24         self.test.case_name = "aaa"
25         self.test.start_time = "1"
26         self.test.stop_time = "5"
27         self.test.criteria = ""
28         self.test.details = {"orchestrator": {"status": "PASS",
29                                               "result": "",
30                                               "duration": 20},
31                              "vnf": {"status": "PASS",
32                                      "result": "",
33                                      "duration": 15},
34                              "test_vnf": {"status": "FAIL",
35                                           "result": "",
36                                           "duration": 5}}
37
38     def test_deploy_vnf_unimplemented(self):
39         with self.assertRaises(Exception) as context:
40             self.test.deploy_vnf()
41         self.assertTrue('VNF not deployed' in context.exception)
42
43     def test_test_vnf_unimplemented(self):
44         with self.assertRaises(Exception) as context:
45             self.test.test_vnf()()
46         self.assertTrue('VNF not tested' in context.exception)
47
48     def test_parse_results(self):
49         self.assertNotEqual(self.test.parse_results(), 0)
50
51
52 if __name__ == "__main__":
53     unittest.main(verbosity=2)