Support different user/project domain values
[functest.git] / functest / tests / unit / vnf / ims / test_cloudify_ims.py
1 #!/usr/bin/env python
2
3 # All rights reserved. This program and the accompanying materials
4 # are made available under the terms of the Apache License, Version 2.0
5 # which accompanies this distribution, and is available at
6 # http://www.apache.org/licenses/LICENSE-2.0
7
8 # pylint: disable=missing-docstring
9
10 import logging
11 import unittest
12
13 import mock
14
15 from functest.core import vnf
16 from functest.opnfv_tests.vnf.ims import cloudify_ims
17
18
19 class CloudifyImsTesting(unittest.TestCase):
20
21     def setUp(self):
22
23         self.tenant = 'cloudify_ims'
24         self.creds = {'username': 'user',
25                       'password': 'pwd'}
26         self.orchestrator = {'name': 'cloudify',
27                              'version': '4.0',
28                              'object': 'foo',
29                              'requirements': {'flavor': {'name': 'm1.medium',
30                                                          'ram_min': 4096},
31                                               'os_image': 'manager_4.0'}}
32
33         self.vnf = {'name': 'clearwater',
34                     'descriptor': {'version': '108',
35                                    'file_name': 'openstack-blueprint.yaml',
36                                    'name': 'clearwater-opnfv',
37                                    'url': 'https://foo',
38                                    'requirements': {'flavor':
39                                                     {'name': 'm1.medium',
40                                                      'ram_min': 2048}}}}
41
42         with mock.patch('functest.opnfv_tests.vnf.ims.cloudify_ims.'
43                         'os.makedirs'), \
44             mock.patch('functest.opnfv_tests.vnf.ims.cloudify_ims.'
45                        'get_config', return_value={
46                            'tenant_images': 'foo',
47                            'orchestrator': self.orchestrator,
48                            'vnf': self.vnf,
49                            'vnf_test_suite': '',
50                            'version': 'whatever'}):
51
52             self.ims_vnf = cloudify_ims.CloudifyIms()
53
54         self.images = {'image1': 'url1',
55                        'image2': 'url2'}
56         self.details = {'orchestrator': {'status': 'PASS', 'duration': 120},
57                         'vnf': {},
58                         'test_vnf':  {}}
59
60     def test_prepare_missing_param(self):
61         with self.assertRaises(vnf.VnfPreparationException):
62             self.ims_vnf.prepare()
63
64
65 if __name__ == "__main__":
66     logging.disable(logging.CRITICAL)
67     unittest.main(verbosity=2)