a891473f3a50cdfe2b700b143495a4945ef479f8
[apex.git] / tests / test_apex_network_settings.py
1 ##############################################################################
2 # Copyright (c) 2016 Dan Radez (Red Hat)
3 #
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 ##############################################################################
9
10 from apex.network_settings import NetworkSettings
11
12 from nose.tools import assert_equal
13 from nose.tools import assert_is_instance
14
15
16 class TestNetworkSettings(object):
17     @classmethod
18     def setup_class(klass):
19         """This method is run once for each class before any tests are run"""
20
21     @classmethod
22     def teardown_class(klass):
23         """This method is run once for each class _after_ all tests are run"""
24
25     def setUp(self):
26         """This method is run once before _each_ test method is executed"""
27
28     def teardown(self):
29         """This method is run once after _each_ test method is executed"""
30
31     def test_init(self):
32         ns = NetworkSettings('../config/network/network_settings.yaml', True)
33
34     def test_dump_bash(self):
35         ns = NetworkSettings('../config/network/network_settings.yaml', True)
36         assert_equal(ns.dump_bash(), None)
37         assert_equal(ns.dump_bash(path='/dev/null'), None)
38
39     def test_get_network_settings(self):
40         ns = NetworkSettings('../config/network/network_settings.yaml', True)
41         assert_is_instance(ns.get_network_settings(), dict)
42
43     def test_get_enabled_networks(self):
44         ns = NetworkSettings('../config/network/network_settings.yaml', True)
45         assert_is_instance(ns.get_enabled_networks(), list)