summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/drivers/third_party_driver_mocks.py
diff options
context:
space:
mode:
authorHugo Nicodemos <nicodemos@lsd.ufcg.edu.br>2017-11-29 14:26:13 -0300
committerFellype Cavalcante <fellypefca@lsd.ufcg.edu.br>2017-12-13 14:57:10 -0300
commit97a8ae1c7765aae06b86162b3191186b14f1c8c6 (patch)
tree5bcac034dcd6ef30e0a69470e3d93ec13cf4a5a1 /ironic/tests/unit/drivers/third_party_driver_mocks.py
parent638943dbf8e4adbcbe81a2af0f8a1d5ffd9771f6 (diff)
downloadironic-97a8ae1c7765aae06b86162b3191186b14f1c8c6.tar.gz
Introduce hpOneView and ilorest to OneView
It introduces the ``hpOneView`` and ``ilorest`` library to the OneView Driver. This patch will be used as the standard patch to other patches related to the removal of the ``python-oneviewclient`` library dependency. Change-Id: Ib9d72ff5713d58631bcdccc817707b5d512e156e Partial-Bug: #1693788 Co-Authored-By: Fellype Cavalcante <fellypefca@lsd.ufcg.edu.br> Co-Authored-By: Ricardo Araujo <ricardo@lsd.ufcg.edu.br>
Diffstat (limited to 'ironic/tests/unit/drivers/third_party_driver_mocks.py')
-rw-r--r--ironic/tests/unit/drivers/third_party_driver_mocks.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/ironic/tests/unit/drivers/third_party_driver_mocks.py b/ironic/tests/unit/drivers/third_party_driver_mocks.py
index 31fec78b7..430293bb6 100644
--- a/ironic/tests/unit/drivers/third_party_driver_mocks.py
+++ b/ironic/tests/unit/drivers/third_party_driver_mocks.py
@@ -26,6 +26,7 @@ Current list of mocked libraries:
- pysnmp
- scciclient
- oneview_client
+- hpOneView
- pywsman
- python-dracclient
"""
@@ -99,6 +100,22 @@ if 'ironic.drivers.oneview' in sys.modules:
six.moves.reload_module(sys.modules['ironic.drivers.modules.oneview'])
+hpOneView = importutils.try_import('hpOneView')
+if not hpOneView:
+ hpOneView = mock.MagicMock(spec_set=mock_specs.HPE_ONEVIEW_SPEC)
+ sys.modules['hpOneView'] = hpOneView
+ sys.modules['hpOneView.oneview_client'] = hpOneView.oneview_client
+ sys.modules['hpOneView.resources'] = hpOneView.resources
+ sys.modules['hpOneView.exceptions'] = hpOneView.exceptions
+ hpOneView.exceptions.HPOneViewException = type('HPOneViewException',
+ (Exception,), {})
+sys.modules['hpOneView.oneview_client'].OneViewClient = mock.MagicMock(
+ spec_set=mock_specs.HPE_ONEVIEW_CLS_SPEC
+)
+if 'ironic.drivers.oneview' in sys.modules:
+ six.moves.reload_module(sys.modules['ironic.drivers.modules.oneview'])
+
+
# attempt to load the external 'python-dracclient' library, which is required
# by the optional drivers.modules.drac module
dracclient = importutils.try_import('dracclient')