mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
LogicalInterconnectGroupFactsModule for HPE OneView (#28847)
* Added support to retrieving LIG resources in HPE OneView * Fixing copyright header according to review * Swapping out config for full credentials in parameter for documentation
This commit is contained in:
parent
12a4dca447
commit
46fd083138
2 changed files with 168 additions and 0 deletions
|
@ -0,0 +1,58 @@
|
|||
# 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)
|
||||
|
||||
from ansible.compat.tests import unittest
|
||||
from oneview_module_loader import OneViewModuleBase
|
||||
from ansible.modules.remote_management.oneview.oneview_logical_interconnect_group_facts import LogicalInterconnectGroupFactsModule
|
||||
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 Logical Interconnect Group"
|
||||
)
|
||||
|
||||
PRESENT_LIGS = [{
|
||||
"name": "Test Logical Interconnect Group",
|
||||
"uri": "/rest/logical-interconnect-groups/ebb4ada8-08df-400e-8fac-9ff987ac5140"
|
||||
}]
|
||||
|
||||
|
||||
class LogicalInterconnectGroupFactsSpec(unittest.TestCase, FactsParamsTestCase):
|
||||
def setUp(self):
|
||||
self.configure_mocks(self, LogicalInterconnectGroupFactsModule)
|
||||
self.logical_interconnect_groups = self.mock_ov_client.logical_interconnect_groups
|
||||
FactsParamsTestCase.configure_client_mock(self, self.logical_interconnect_groups)
|
||||
|
||||
def test_should_get_all_ligs(self):
|
||||
self.logical_interconnect_groups.get_all.return_value = PRESENT_LIGS
|
||||
self.mock_ansible_module.params = PARAMS_GET_ALL
|
||||
|
||||
LogicalInterconnectGroupFactsModule().run()
|
||||
|
||||
self.mock_ansible_module.exit_json.assert_called_once_with(
|
||||
changed=False,
|
||||
ansible_facts=dict(logical_interconnect_groups=(PRESENT_LIGS))
|
||||
)
|
||||
|
||||
def test_should_get_lig_by_name(self):
|
||||
self.logical_interconnect_groups.get_by.return_value = PRESENT_LIGS
|
||||
self.mock_ansible_module.params = PARAMS_GET_BY_NAME
|
||||
|
||||
LogicalInterconnectGroupFactsModule().run()
|
||||
|
||||
self.mock_ansible_module.exit_json.assert_called_once_with(
|
||||
changed=False,
|
||||
ansible_facts=dict(logical_interconnect_groups=(PRESENT_LIGS))
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Add table
Add a link
Reference in a new issue