Add case_name as constructor arg
[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_name='aaa')
23         self.test.project = "functest"
24         self.test.start_time = "1"
25         self.test.stop_time = "5"
26         self.test.criteria = ""
27         self.test.details = {"orchestrator": {"status": "PASS",
28                                               "result": "",
29                                               "duration": 20},
30                              "vnf": {"status": "PASS",
31                                      "result": "",
32                                      "duration": 15},
33                              "test_vnf": {"status": "FAIL",
34                                           "result": "",
35                                           "duration": 5}}
36
37     def test_deploy_vnf_unimplemented(self):
38         with self.assertRaises(Exception) as context:
39             self.test.deploy_vnf()
40         self.assertTrue('VNF not deployed' in context.exception)
41
42     def test_test_vnf_unimplemented(self):
43         with self.assertRaises(Exception) as context:
44             self.test.test_vnf()()
45         self.assertTrue('VNF not tested' in context.exception)
46
47     def test_parse_results(self):
48         self.assertNotEqual(self.test.parse_results(), 0)
49
50
51 if __name__ == "__main__":
52     unittest.main(verbosity=2)