1 ##############################################################################
2 # Copyright (c) 2016 Dan Radez (Red Hat)
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
11 # https://docs.python.org/3/library/io.html
13 from apex.deploy_env import DeploySettings
14 from apex.deploy_env import DeploySettingsException
16 from nose.tools import assert_equal
17 from nose.tools import assert_raises
19 deploy_files = ('deploy_settings.yaml',
20 'os-nosdn-nofeature-noha.yaml',
21 'os-nosdn-ovs-noha.yaml',
22 'os-ocl-nofeature-ha.yaml',
23 'os-odl_l2-sdnvpn-ha.yaml',
24 'os-odl_l3-nofeature-ha.yaml',
25 'os-nosdn-nofeature-ha.yaml',
26 'os-nosdn-ovs-ha.yaml',
27 'os-nosdn-performance-ha.yaml',
28 'os-odl_l2-nofeature-ha.yaml',
29 'os-odl_l2-sfc-noha.yaml',
30 'os-onos-nofeature-ha.yaml')
32 test_deploy_content = (
34 'deploy_options: string',
35 """deploy_options: string
57 class TestIpUtils(object):
59 def setup_class(klass):
60 """This method is run once for each class before any tests are run"""
63 def teardown_class(klass):
64 """This method is run once for each class _after_ all tests are run"""
67 """This method is run once before _each_ test method is executed"""
70 """This method is run once after _each_ test method is executed"""
73 for f in deploy_files:
74 ds = DeploySettings('../config/deploy/{}'.format(f))
76 def test__validate_settings(self):
77 for c in test_deploy_content:
78 f = open('/tmp/apex_deploy_test_file', 'w')
81 assert_raises(DeploySettingsException, DeploySettings, '/tmp/apex_deploy_test_file')
83 def test_dump_bash(self):
84 # the performance file has the most use of the function
85 # so using that as the test case
86 ds = DeploySettings('../config/deploy/os-nosdn-performance-ha.yaml')
87 assert_equal(ds.dump_bash(), None)
88 assert_equal(ds.dump_bash(path='/dev/null'), None)