1 # Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs")
2 # and others. All rights reserved.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
17 from snaps.openstack.os_credentials import OSCreds
18 from snaps.openstack.tests.os_source_file_test import OSComponentTestCase
19 from snaps.openstack.utils import magnum_utils
21 __author__ = 'spisarski'
23 logger = logging.getLogger('magnum_utils_tests')
26 class MagnumSmokeTests(OSComponentTestCase):
28 Tests to ensure that the magnum client can communicate with the cloud
31 def test_connect_success(self):
33 Tests to ensure that the proper credentials can connect.
35 magnum = magnum_utils.magnum_client(self.os_creds)
37 # This should not throw an exception
38 magnum.clusters.list()
40 def test_nova_connect_fail(self):
42 Tests to ensure that the improper credentials cannot connect.
45 with self.assertRaises(RuntimeError):
46 magnum_utils.magnum_client(
47 OSCreds(username='user', password='pass',
48 auth_url=self.os_creds.auth_url,
49 project_name=self.os_creds.project_name,
50 proxy_settings=self.os_creds.proxy_settings))