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
13 from functest.opnfv_tests.vnf.ims import clearwater_ims_base as ims_base
16 class ClearwaterOnBoardingBaseTesting(unittest.TestCase):
19 with mock.patch('functest.opnfv_tests.vnf.ims.cloudify_ims.'
21 self.ims_vnf = ims_base.ClearwaterOnBoardingBase()
23 self.mock_post = mock.Mock()
24 attrs = {'status_code': 201,
26 self.mock_post.configure_mock(**attrs)
28 self.mock_post_200 = mock.Mock()
29 attrs = {'status_code': 200,
31 self.mock_post_200.configure_mock(**attrs)
33 self.mock_post_500 = mock.Mock()
34 attrs = {'status_code': 500,
36 self.mock_post_200.configure_mock(**attrs)
38 def test_create_ellis_number_failure(self):
39 with mock.patch('functest.opnfv_tests.vnf.ims.'
40 'clearwater_ims_base.requests.post',
41 return_value=self.mock_post_500), \
42 self.assertRaises(Exception) as context:
43 self.ims_vnf.create_ellis_number()
45 msg = "Unable to create a number:"
46 self.assertTrue(msg in context.exception)
48 def _get_post_status(self, url, cookies='', data=''):
49 ellis_url = "http://test_ellis_ip/session"
51 return self.mock_post_200
55 if __name__ == "__main__":
56 logging.disable(logging.CRITICAL)
57 unittest.main(verbosity=2)