mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.6 KiB
Python
58 lines
1.6 KiB
Python
![]()
7 years ago
|
# Copyright (c) 2016-2017 Hewlett Packard Enterprise Development LP
|
||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||
|
|
||
![]()
6 years ago
|
from units.compat import unittest
|
||
![]()
5 years ago
|
from oneview_module_loader import FcNetworkInfoModule
|
||
![]()
7 years ago
|
from hpe_test_utils import FactsParamsTestCase
|
||
|
|
||
|
ERROR_MSG = 'Fake message error'
|
||
|
|
||
|
PARAMS_GET_ALL = dict(
|
||
|
config='config.json',
|
||
|
name=None
|
||
|
)
|
||
|
|
||
|
PARAMS_GET_BY_NAME = dict(
|
||
|
config='config.json',
|
||
|
name="Test FC Network"
|
||
|
)
|
||
|
|
||
|
PRESENT_NETWORKS = [{
|
||
|
"name": "Test FC Network",
|
||
|
"uri": "/rest/fc-networks/c6bf9af9-48e7-4236-b08a-77684dc258a5"
|
||
|
}]
|
||
|
|
||
|
|
||
![]()
5 years ago
|
class FcNetworkInfoSpec(unittest.TestCase,
|
||
|
FactsParamsTestCase):
|
||
![]()
7 years ago
|
def setUp(self):
|
||
![]()
5 years ago
|
self.configure_mocks(self, FcNetworkInfoModule)
|
||
![]()
7 years ago
|
self.fc_networks = self.mock_ov_client.fc_networks
|
||
|
FactsParamsTestCase.configure_client_mock(self, self.fc_networks)
|
||
|
|
||
|
def test_should_get_all_fc_networks(self):
|
||
|
self.fc_networks.get_all.return_value = PRESENT_NETWORKS
|
||
|
self.mock_ansible_module.params = PARAMS_GET_ALL
|
||
|
|
||
![]()
5 years ago
|
FcNetworkInfoModule().run()
|
||
![]()
7 years ago
|
|
||
|
self.mock_ansible_module.exit_json.assert_called_once_with(
|
||
|
changed=False,
|
||
![]()
5 years ago
|
fc_networks=PRESENT_NETWORKS
|
||
![]()
7 years ago
|
)
|
||
|
|
||
|
def test_should_get_fc_network_by_name(self):
|
||
|
self.fc_networks.get_by.return_value = PRESENT_NETWORKS
|
||
|
self.mock_ansible_module.params = PARAMS_GET_BY_NAME
|
||
|
|
||
![]()
5 years ago
|
FcNetworkInfoModule().run()
|
||
![]()
7 years ago
|
|
||
|
self.mock_ansible_module.exit_json.assert_called_once_with(
|
||
|
changed=False,
|
||
![]()
5 years ago
|
fc_networks=PRESENT_NETWORKS
|
||
![]()
7 years ago
|
)
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
unittest.main()
|