Update testing to yoga

Update jobs and requirements to yoga
Also fix tests where needed

Change-Id: I5dbf28d0ac77d81cc8f79496777aa15be3c52dd0
This commit is contained in:
Riccardo Pittau 2021-11-26 10:30:19 +01:00
parent 500f518d40
commit 682eb63985
53 changed files with 251 additions and 220 deletions

View File

@ -1,4 +1,4 @@
- project: - project:
templates: templates:
- openstack-python3-victoria-jobs - openstack-python3-yoga-jobs
- openstack-cover-jobs - openstack-cover-jobs

View File

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
import testtools import testtools
from proliantutils import exception from proliantutils import exception

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
import time import time
from unittest import mock
import mock
import testtools import testtools
from proliantutils import exception from proliantutils import exception

View File

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from oslo_concurrency import processutils from oslo_concurrency import processutils
import testtools import testtools

View File

@ -12,9 +12,10 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import unittest
import mock
import unittest
from unittest import mock
from proliantutils.ilo.snmp import snmp_cpqdisk_sizes as snmp from proliantutils.ilo.snmp import snmp_cpqdisk_sizes as snmp
from proliantutils.tests.ilo.snmp import snmp_sample_output from proliantutils.tests.ilo.snmp import snmp_sample_output

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
"""Test class for Client Module.""" """Test class for Client Module."""
from unittest import mock
import mock
import testtools import testtools
from proliantutils import exception from proliantutils import exception
@ -35,7 +35,6 @@ def get_cls_wrapper(cls, cache=True):
class IloCacheNodeTestCase(testtools.TestCase): class IloCacheNodeTestCase(testtools.TestCase):
def test_cache_node_cache_true(self): def test_cache_node_cache_true(self):
class Dummyclass1(object): class Dummyclass1(object):
pass pass
@ -43,7 +42,6 @@ class IloCacheNodeTestCase(testtools.TestCase):
self.assertNotEqual(id(original_cls), id(decorated_cls)) self.assertNotEqual(id(original_cls), id(decorated_cls))
def test_cache_node_cache_false(self): def test_cache_node_cache_false(self):
class Dummyclass2(object): class Dummyclass2(object):
pass pass
@ -53,7 +51,6 @@ class IloCacheNodeTestCase(testtools.TestCase):
class IloClientWrapperTestCase(testtools.TestCase): class IloClientWrapperTestCase(testtools.TestCase):
class DummyClass(object): class DummyClass(object):
def __init__(self, ip, name, password): def __init__(self, ip, name, password):
self._ip = ip self._ip = ip
@ -256,7 +253,6 @@ class IloClientInitTestCase(testtools.TestCase):
@mock.patch.object(redfish, 'RedfishOperations') @mock.patch.object(redfish, 'RedfishOperations')
def test_init_with_use_redfish_only_set( def test_init_with_use_redfish_only_set(
self, redfish_mock, ribcl_mock): self, redfish_mock, ribcl_mock):
c = client.IloClient.cls("1.2.3.4", "admin", "Admin", c = client.IloClient.cls("1.2.3.4", "admin", "Admin",
timeout=120, port=4430, timeout=120, port=4430,
bios_password='foo', cacert='/somewhere', bios_password='foo', cacert='/somewhere',
@ -436,6 +432,7 @@ class IloClientTestCase(testtools.TestCase):
true | false | false | test__call_method_redfish_4 true | false | false | test__call_method_redfish_4
===========|==========|====================|============================= ===========|==========|====================|=============================
""" """
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
@mock.patch.object(redfish, 'RedfishOperations') @mock.patch.object(redfish, 'RedfishOperations')
def test__call_method_redfish_1(self, redfish_mock, def test__call_method_redfish_1(self, redfish_mock,
@ -900,19 +897,19 @@ class IloClientTestCase(testtools.TestCase):
def test_delete_raid_configuration_gen9(self, get_product_mock): def test_delete_raid_configuration_gen9(self, get_product_mock):
self.client.model = 'Gen9' self.client.model = 'Gen9'
get_product_mock.return_value = 'ProLiant BL460c Gen9' get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'`delete_raid_configuration` is not supported ' '`delete_raid_configuration` is not supported '
'on ProLiant BL460c Gen9', 'on ProLiant BL460c Gen9',
self.client.delete_raid_configuration) self.client.delete_raid_configuration)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_delete_raid_configuration_gen8(self, get_product_mock): def test_delete_raid_configuration_gen8(self, get_product_mock):
self.client.model = 'Gen8' self.client.model = 'Gen8'
get_product_mock.return_value = 'ProLiant DL380 G8' get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'`delete_raid_configuration` is not supported ' '`delete_raid_configuration` is not supported '
'on ProLiant DL380 G8', 'on ProLiant DL380 G8',
self.client.delete_raid_configuration) self.client.delete_raid_configuration)
@mock.patch.object(client.IloClient.cls, '_call_method') @mock.patch.object(client.IloClient.cls, '_call_method')
def test_do_disk_erase(self, call_mock): def test_do_disk_erase(self, call_mock):
@ -924,21 +921,21 @@ class IloClientTestCase(testtools.TestCase):
def test_do_disk_erase_gen9(self, get_product_mock): def test_do_disk_erase_gen9(self, get_product_mock):
self.client.model = 'Gen9' self.client.model = 'Gen9'
get_product_mock.return_value = 'ProLiant BL460c Gen9' get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'The specified operation is not supported ' 'The specified operation is not supported '
'on current platform.', 'on current platform.',
self.client.do_disk_erase, self.client.do_disk_erase,
'SSD', None) 'SSD', None)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_do_disk_erase_gen8(self, get_product_mock): def test_do_disk_erase_gen8(self, get_product_mock):
self.client.model = 'Gen8' self.client.model = 'Gen8'
get_product_mock.return_value = 'ProLiant DL380 G8' get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'The specified operation is not supported ' 'The specified operation is not supported '
'on current platform.', 'on current platform.',
self.client.do_disk_erase, self.client.do_disk_erase,
'SSD', None) 'SSD', None)
@mock.patch.object(client.IloClient.cls, '_call_method') @mock.patch.object(client.IloClient.cls, '_call_method')
def test_do_one_button_secure_erase(self, call_mock): def test_do_one_button_secure_erase(self, call_mock):
@ -949,19 +946,19 @@ class IloClientTestCase(testtools.TestCase):
def test_do_one_button_secure_erase_gen9(self, get_product_mock): def test_do_one_button_secure_erase_gen9(self, get_product_mock):
self.client.model = 'Gen9' self.client.model = 'Gen9'
get_product_mock.return_value = 'ProLiant BL460c Gen9' get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'The specified operation is not supported ' 'The specified operation is not supported '
'on current platform.', 'on current platform.',
self.client.do_one_button_secure_erase) self.client.do_one_button_secure_erase)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_do_one_button_secure_erase_gen8(self, get_product_mock): def test_do_one_button_secure_erase_gen8(self, get_product_mock):
self.client.model = 'Gen8' self.client.model = 'Gen8'
get_product_mock.return_value = 'ProLiant DL380 G8' get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'The specified operation is not supported ' 'The specified operation is not supported '
'on current platform.', 'on current platform.',
self.client.do_one_button_secure_erase) self.client.do_one_button_secure_erase)
@mock.patch.object(client.IloClient.cls, '_call_method') @mock.patch.object(client.IloClient.cls, '_call_method')
def test_has_disk_erase_completed(self, call_mock): def test_has_disk_erase_completed(self, call_mock):
@ -972,19 +969,19 @@ class IloClientTestCase(testtools.TestCase):
def test_has_disk_erase_completed_gen9(self, get_product_mock): def test_has_disk_erase_completed_gen9(self, get_product_mock):
self.client.model = 'Gen9' self.client.model = 'Gen9'
get_product_mock.return_value = 'ProLiant BL460c Gen9' get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'The specified operation is not supported ' 'The specified operation is not supported '
'on current platform.', 'on current platform.',
self.client.has_disk_erase_completed) self.client.has_disk_erase_completed)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_has_disk_erase_completed_gen8(self, get_product_mock): def test_has_disk_erase_completed_gen8(self, get_product_mock):
self.client.model = 'Gen8' self.client.model = 'Gen8'
get_product_mock.return_value = 'ProLiant DL380 G8' get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'The specified operation is not supported ' 'The specified operation is not supported '
'on current platform.', 'on current platform.',
self.client.has_disk_erase_completed) self.client.has_disk_erase_completed)
@mock.patch.object(client.IloClient.cls, '_call_method') @mock.patch.object(client.IloClient.cls, '_call_method')
def test_create_raid_configuration(self, call_mock): def test_create_raid_configuration(self, call_mock):
@ -1000,11 +997,11 @@ class IloClientTestCase(testtools.TestCase):
ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True} ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True}
raid_config = {"logical_disks": [ld1]} raid_config = {"logical_disks": [ld1]}
get_product_mock.return_value = 'ProLiant BL460c Gen9' get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'`create_raid_configuration` is not supported ' '`create_raid_configuration` is not supported '
'on ProLiant BL460c Gen9', 'on ProLiant BL460c Gen9',
self.client.create_raid_configuration, self.client.create_raid_configuration,
raid_config) raid_config)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_create_raid_configuration_gen8(self, get_product_mock): def test_create_raid_configuration_gen8(self, get_product_mock):
@ -1012,11 +1009,11 @@ class IloClientTestCase(testtools.TestCase):
ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True} ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True}
raid_config = {"logical_disks": [ld1]} raid_config = {"logical_disks": [ld1]}
get_product_mock.return_value = 'ProLiant DL380 G8' get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'`create_raid_configuration` is not supported ' '`create_raid_configuration` is not supported '
'on ProLiant DL380 G8', 'on ProLiant DL380 G8',
self.client.create_raid_configuration, self.client.create_raid_configuration,
raid_config) raid_config)
@mock.patch.object(client.IloClient.cls, '_call_method') @mock.patch.object(client.IloClient.cls, '_call_method')
def test_read_raid_configuration(self, call_mock): def test_read_raid_configuration(self, call_mock):
@ -1032,11 +1029,11 @@ class IloClientTestCase(testtools.TestCase):
ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True} ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True}
raid_config = {"logical_disks": [ld1]} raid_config = {"logical_disks": [ld1]}
get_product_mock.return_value = 'ProLiant BL460c Gen9' get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'`read_raid_configuration` is not supported ' '`read_raid_configuration` is not supported '
'on ProLiant BL460c Gen9', 'on ProLiant BL460c Gen9',
self.client.read_raid_configuration, self.client.read_raid_configuration,
raid_config) raid_config)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_read_raid_configuration_gen8(self, get_product_mock): def test_read_raid_configuration_gen8(self, get_product_mock):
@ -1044,11 +1041,11 @@ class IloClientTestCase(testtools.TestCase):
ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True} ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True}
raid_config = {"logical_disks": [ld1]} raid_config = {"logical_disks": [ld1]}
get_product_mock.return_value = 'ProLiant DL380 G8' get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'`read_raid_configuration` is not supported ' '`read_raid_configuration` is not supported '
'on ProLiant DL380 G8', 'on ProLiant DL380 G8',
self.client.read_raid_configuration, self.client.read_raid_configuration,
raid_config) raid_config)
@mock.patch.object(ris.RISOperations, 'eject_virtual_media') @mock.patch.object(ris.RISOperations, 'eject_virtual_media')
def test_eject_virtual_media_gen9(self, eject_virtual_media_mock): def test_eject_virtual_media_gen9(self, eject_virtual_media_mock):
@ -1317,7 +1314,6 @@ class IloClientTestCase(testtools.TestCase):
@mock.patch.object(client.IloClient.cls, '_call_method') @mock.patch.object(client.IloClient.cls, '_call_method')
def test_get_essential_prop_snmp_false_local_gb_0(self, call_mock, def test_get_essential_prop_snmp_false_local_gb_0(self, call_mock,
snmp_mock): snmp_mock):
self.client.model = 'Gen9' self.client.model = 'Gen9'
snmp_credentials = {'auth_user': 'user', snmp_credentials = {'auth_user': 'user',
'auth_prot_pp': '1234', 'auth_prot_pp': '1234',
@ -1348,9 +1344,9 @@ class IloClientTestCase(testtools.TestCase):
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_inject_nmi_gen8(self, product_mock): def test_inject_nmi_gen8(self, product_mock):
self.client.model = 'Gen8' self.client.model = 'Gen8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'not supported', 'not supported',
self.client.inject_nmi) self.client.inject_nmi)
@mock.patch.object(client.IloClient.cls, '_call_method') @mock.patch.object(client.IloClient.cls, '_call_method')
def test_get_host_post_state(self, call_mock): def test_get_host_post_state(self, call_mock):
@ -1383,9 +1379,9 @@ class IloClientTestCase(testtools.TestCase):
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_get_bios_settings_result_gen8(self, product_mock): def test_get_bios_settings_result_gen8(self, product_mock):
self.client.model = 'Gen8' self.client.model = 'Gen8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'not supported', 'not supported',
self.client.get_bios_settings_result) self.client.get_bios_settings_result)
@mock.patch.object(client.IloClient.cls, '_call_method') @mock.patch.object(client.IloClient.cls, '_call_method')
def test_get_available_disk_types(self, call_mock): def test_get_available_disk_types(self, call_mock):
@ -1396,17 +1392,17 @@ class IloClientTestCase(testtools.TestCase):
def test_get_available_disk_types_gen9(self, get_product_mock): def test_get_available_disk_types_gen9(self, get_product_mock):
self.client.model = 'Gen9' self.client.model = 'Gen9'
get_product_mock.return_value = 'ProLiant BL460c Gen9' get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'not supported', 'not supported',
self.client.get_available_disk_types) self.client.get_available_disk_types)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_get_available_disk_types_gen8(self, get_product_mock): def test_get_available_disk_types_gen8(self, get_product_mock):
self.client.model = 'Gen8' self.client.model = 'Gen8'
get_product_mock.return_value = 'ProLiant DL380 G8' get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'not supported', 'not supported',
self.client.get_available_disk_types) self.client.get_available_disk_types)
class IloRedfishClientTestCase(testtools.TestCase): class IloRedfishClientTestCase(testtools.TestCase):
@ -1453,7 +1449,7 @@ class IloRedfishClientTestCase(testtools.TestCase):
validate_method_calls( validate_method_calls(
more_missed_operations, ('arg1', 'arg2'), more_missed_operations, ('arg1', 'arg2'),
even_more_missed_operations) even_more_missed_operations)
if(len(even_more_missed_operations) == 1): if (len(even_more_missed_operations) == 1):
self.assertEqual('set_iscsi_info', self.assertEqual('set_iscsi_info',
even_more_missed_operations[0]) even_more_missed_operations[0])
else: else:

View File

@ -16,9 +16,9 @@
import time import time
import unittest import unittest
from unittest import mock
import ddt import ddt
import mock
from proliantutils import exception from proliantutils import exception
from proliantutils.ilo import common from proliantutils.ilo import common

View File

@ -18,9 +18,9 @@ import os
import shutil import shutil
import tempfile import tempfile
import unittest import unittest
from unittest import mock
import ddt import ddt
import mock
from six.moves import builtins as __builtin__ from six.moves import builtins as __builtin__
from proliantutils import exception from proliantutils import exception
@ -467,6 +467,9 @@ class FirmwareImageExtractorTestCase(unittest.TestCase):
'extracted_file_from_scexe', 'extracted_file_from_scexe',
'extracted_file_from_rpm', 'extracted_file_from_rpm',
] ]
tempfile_mock.mkdtemp.side_effect = [
'/tmp', '/tmp', '/tmp'
]
# | WHEN | # | WHEN |
for fw_file in firmware_files: for fw_file in firmware_files:
fw_img_extractor = firmware_controller.get_fw_extractor(fw_file) fw_img_extractor = firmware_controller.get_fw_extractor(fw_file)

View File

@ -17,8 +17,7 @@
import subprocess import subprocess
import unittest import unittest
from unittest import mock
import mock
from proliantutils.ilo import ipmi from proliantutils.ilo import ipmi
from proliantutils.tests.ilo import ipmi_sample_outputs as constants from proliantutils.tests.ilo import ipmi_sample_outputs as constants

View File

@ -18,10 +18,10 @@
import json import json
import re import re
import unittest import unittest
from unittest import mock
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
import ddt import ddt
import mock
import requests import requests
from requests.packages import urllib3 from requests.packages import urllib3
from requests.packages.urllib3 import exceptions as urllib3_exceptions from requests.packages.urllib3 import exceptions as urllib3_exceptions
@ -328,9 +328,13 @@ class IloRibclTestCase(unittest.TestCase):
self, raw_boot_mode_value, expected_boot_mode_value, self, raw_boot_mode_value, expected_boot_mode_value,
_execute_command_mock): _execute_command_mock):
# | GIVEN | # | GIVEN |
ret_val = {'GET_SUPPORTED_BOOT_MODE': ret_val = {
{'SUPPORTED_BOOT_MODE': 'GET_SUPPORTED_BOOT_MODE': {
{'VALUE': raw_boot_mode_value}}} 'SUPPORTED_BOOT_MODE': {
'VALUE': raw_boot_mode_value
}
}
}
_execute_command_mock.return_value = ret_val _execute_command_mock.return_value = ret_val
# | WHEN | # | WHEN |
actual_val = self.ilo.get_supported_boot_mode() actual_val = self.ilo.get_supported_boot_mode()
@ -720,17 +724,17 @@ class IloRibclTestCase(unittest.TestCase):
json_data = json.loads(data) json_data = json.loads(data)
health_data_mock.return_value = json_data health_data_mock.return_value = json_data
expected_properties = {'macs': { expected_properties = {'macs': {
u'Port 4': u'40:a8:f0:1e:86:77', u'Port 4': u'40:a8:f0:1e:86:77',
u'Port 3': u'40:a8:f0:1e:86:76', u'Port 3': u'40:a8:f0:1e:86:76',
u'Port 2': u'40:a8:f0:1e:86:75', u'Port 2': u'40:a8:f0:1e:86:75',
u'Port 1': u'40:a8:f0:1e:86:74' u'Port 1': u'40:a8:f0:1e:86:74'
}, },
'properties': { 'properties': {
'memory_mb': 32768, 'memory_mb': 32768,
'cpu_arch': 'x86_64', 'cpu_arch': 'x86_64',
'local_gb': 98, 'local_gb': 98,
'cpus': 32} 'cpus': 32}
} }
properties = self.ilo.get_essential_properties() properties = self.ilo.get_essential_properties()
self.assertIsInstance(properties, dict) self.assertIsInstance(properties, dict)
self.assertIn('macs', properties) self.assertIn('macs', properties)
@ -1056,50 +1060,50 @@ class IloRibclTestCaseBeforeRisSupport(unittest.TestCase):
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_inject_nmi(self, product_name_mock): def test_inject_nmi(self, product_name_mock):
product_name_mock.return_value = constants.GET_PRODUCT_NAME product_name_mock.return_value = constants.GET_PRODUCT_NAME
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'ProLiant DL380 G7', 'ProLiant DL380 G7',
self.ilo.inject_nmi) self.ilo.inject_nmi)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_get_host_post_state(self, product_name_mock): def test_get_host_post_state(self, product_name_mock):
product_name_mock.return_value = constants.GET_PRODUCT_NAME product_name_mock.return_value = constants.GET_PRODUCT_NAME
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'ProLiant DL380 G7', 'ProLiant DL380 G7',
self.ilo.get_host_post_state) self.ilo.get_host_post_state)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_read_raid_configuration(self, product_name_mock): def test_read_raid_configuration(self, product_name_mock):
ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True} ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True}
raid_config = {"logical_disks": [ld1]} raid_config = {"logical_disks": [ld1]}
product_name_mock.return_value = constants.GET_PRODUCT_NAME product_name_mock.return_value = constants.GET_PRODUCT_NAME
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'ProLiant DL380 G7', 'ProLiant DL380 G7',
self.ilo.read_raid_configuration, self.ilo.read_raid_configuration,
raid_config) raid_config)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_delete_raid_configuration(self, product_name_mock): def test_delete_raid_configuration(self, product_name_mock):
product_name_mock.return_value = constants.GET_PRODUCT_NAME product_name_mock.return_value = constants.GET_PRODUCT_NAME
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'ProLiant DL380 G7', 'ProLiant DL380 G7',
self.ilo.delete_raid_configuration) self.ilo.delete_raid_configuration)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_create_raid_configuration(self, product_name_mock): def test_create_raid_configuration(self, product_name_mock):
ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True} ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True}
raid_config = {"logical_disks": [ld1]} raid_config = {"logical_disks": [ld1]}
product_name_mock.return_value = constants.GET_PRODUCT_NAME product_name_mock.return_value = constants.GET_PRODUCT_NAME
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'ProLiant DL380 G7', 'ProLiant DL380 G7',
self.ilo.create_raid_configuration, self.ilo.create_raid_configuration,
raid_config) raid_config)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name') @mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_get_bios_settings_result(self, product_name_mock): def test_get_bios_settings_result(self, product_name_mock):
product_name_mock.return_value = constants.GET_PRODUCT_NAME product_name_mock.return_value = constants.GET_PRODUCT_NAME
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'ProLiant DL380 G7', 'ProLiant DL380 G7',
self.ilo.get_bios_settings_result) self.ilo.get_bios_settings_result)
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -16,9 +16,9 @@
"""Test class for RIS Module.""" """Test class for RIS Module."""
import json import json
from unittest import mock
import ddt import ddt
import mock
from requests.packages import urllib3 from requests.packages import urllib3
from requests.packages.urllib3 import exceptions as urllib3_exceptions from requests.packages.urllib3 import exceptions as urllib3_exceptions
import testtools import testtools
@ -455,8 +455,15 @@ class IloRisTestCase(testtools.TestCase):
self, raw_boot_mode_value, expected_boot_mode_value, self, raw_boot_mode_value, expected_boot_mode_value,
_get_host_details_mock): _get_host_details_mock):
# | GIVEN | # | GIVEN |
system_val = {'Oem': {'Hp': {'Bios': system_val = {
{'UefiClass': raw_boot_mode_value}}}} 'Oem': {
'Hp': {
'Bios': {
'UefiClass': raw_boot_mode_value
}
}
}
}
_get_host_details_mock.return_value = system_val _get_host_details_mock.return_value = system_val
# | WHEN | # | WHEN |
actual_val = self.client.get_supported_boot_mode() actual_val = self.client.get_supported_boot_mode()
@ -1833,11 +1840,13 @@ class TestRISOperationsPrivateMethods(testtools.TestCase):
map_settings = json.loads(ris_outputs.GET_BIOS_MAPPINGS) map_settings = json.loads(ris_outputs.GET_BIOS_MAPPINGS)
mappings_mock.return_value = map_settings mappings_mock.return_value = map_settings
iscsi_uri = '/rest/v1/systems/1/bios/iScsi/Settings' iscsi_uri = '/rest/v1/systems/1/bios/iScsi/Settings'
properties = {'iSCSITargetName': properties = {
'iqn.2011-07.com.example.server:test1', 'iSCSITargetName':
'iSCSIBootLUN': '1', 'iqn.2011-07.com.example.server:test1',
'iSCSITargetIpAddress': '10.10.1.30', 'iSCSIBootLUN': '1',
'iSCSITargetTcpPort': 3260} 'iSCSITargetIpAddress': '10.10.1.30',
'iSCSITargetTcpPort': 3260
}
settings = json.loads(ris_outputs.GET_ISCSI_PATCH) settings = json.loads(ris_outputs.GET_ISCSI_PATCH)
check_iscsi_mock.return_value = iscsi_uri check_iscsi_mock.return_value = iscsi_uri
patch_mock.return_value = (200, ris_outputs.GET_HEADERS, patch_mock.return_value = (200, ris_outputs.GET_HEADERS,
@ -1857,11 +1866,13 @@ class TestRISOperationsPrivateMethods(testtools.TestCase):
validate_mock): validate_mock):
nic_association_mock.return_value = 'NicBoot1' nic_association_mock.return_value = 'NicBoot1'
iscsi_uri = '/rest/v1/systems/1/bios/iScsi/Settings' iscsi_uri = '/rest/v1/systems/1/bios/iScsi/Settings'
properties = {'iSCSITargetName': properties = {
'iqn.2011-07.com.example.server:test1', 'iSCSITargetName':
'iSCSIBootLUN': '1', 'iqn.2011-07.com.example.server:test1',
'iSCSITargetIpAddress': '10.10.1.30', 'iSCSIBootLUN': '1',
'iSCSITargetTcpPort': 3260} 'iSCSITargetIpAddress': '10.10.1.30',
'iSCSITargetTcpPort': 3260
}
settings = json.loads(ris_outputs.GET_ISCSI_PATCH) settings = json.loads(ris_outputs.GET_ISCSI_PATCH)
check_iscsi_mock.return_value = iscsi_uri check_iscsi_mock.return_value = iscsi_uri
patch_mock.return_value = (200, ris_outputs.GET_HEADERS, patch_mock.return_value = (200, ris_outputs.GET_HEADERS,
@ -1919,11 +1930,13 @@ class TestRISOperationsPrivateMethods(testtools.TestCase):
map_settings = json.loads(ris_outputs.GET_BIOS_MAPPINGS) map_settings = json.loads(ris_outputs.GET_BIOS_MAPPINGS)
mappings_mock.return_value = map_settings mappings_mock.return_value = map_settings
iscsi_uri = '/rest/v1/systems/1/bios/iScsi/Settings' iscsi_uri = '/rest/v1/systems/1/bios/iScsi/Settings'
properties = {'iSCSITargetName': properties = {
'iqn.2011-07.com.example.server:test1', 'iSCSITargetName':
'iSCSIBootLUN': '1', 'iqn.2011-07.com.example.server:test1',
'iSCSITargetIpAddress': '10.10.1.30', 'iSCSIBootLUN': '1',
'iSCSITargetTcpPort': 3260} 'iSCSITargetIpAddress': '10.10.1.30',
'iSCSITargetTcpPort': 3260
}
settings = json.loads(ris_outputs.GET_ISCSI_PATCH) settings = json.loads(ris_outputs.GET_ISCSI_PATCH)
check_iscsi_mock.return_value = iscsi_uri check_iscsi_mock.return_value = iscsi_uri
patch_mock.return_value = (301, ris_outputs.GET_HEADERS, patch_mock.return_value = (301, ris_outputs.GET_HEADERS,
@ -2212,8 +2225,10 @@ class TestRISOperationsPrivateMethods(testtools.TestCase):
def test__update_persistent_boot_for_UefiShell(self, rest_patch_mock): def test__update_persistent_boot_for_UefiShell(self, rest_patch_mock):
systems_uri = "/rest/v1/Systems/1" systems_uri = "/rest/v1/Systems/1"
new_boot_settings = {} new_boot_settings = {}
new_boot_settings['Boot'] = {'BootSourceOverrideEnabled': 'Continuous', new_boot_settings['Boot'] = {
'BootSourceOverrideTarget': 'UefiShell'} 'BootSourceOverrideEnabled': 'Continuous',
'BootSourceOverrideTarget': 'UefiShell'
}
rest_patch_mock.return_value = (200, ris_outputs.GET_HEADERS, rest_patch_mock.return_value = (200, ris_outputs.GET_HEADERS,
ris_outputs.REST_POST_RESPONSE) ris_outputs.REST_POST_RESPONSE)
self.client._update_persistent_boot(['UefiShell'], self.client._update_persistent_boot(['UefiShell'],
@ -2229,13 +2244,15 @@ class TestRISOperationsPrivateMethods(testtools.TestCase):
json.loads(ris_outputs.RESPONSE_BODY_FOR_REST_OP_WITH_ISCSI)) json.loads(ris_outputs.RESPONSE_BODY_FOR_REST_OP_WITH_ISCSI))
systems_uri = '/rest/v1/Systems/1' systems_uri = '/rest/v1/Systems/1'
new1_boot_settings = {} new1_boot_settings = {}
new1_boot_settings['Boot'] = {'UefiTargetBootSourceOverride': new1_boot_settings['Boot'] = {
u'NIC.LOM.1.1.iSCSI'} 'UefiTargetBootSourceOverride':
u'NIC.LOM.1.1.iSCSI'
}
new2_boot_settings = {} new2_boot_settings = {}
new2_boot_settings['Boot'] = {'BootSourceOverrideEnabled': new2_boot_settings['Boot'] = {
'Continuous', 'BootSourceOverrideTarget': 'BootSourceOverrideEnabled': 'Continuous',
'UefiTarget'} 'BootSourceOverrideTarget': 'UefiTarget'
}
rest_patch_mock.return_value = (200, ris_outputs.GET_HEADERS, rest_patch_mock.return_value = (200, ris_outputs.GET_HEADERS,
ris_outputs.REST_POST_RESPONSE) ris_outputs.REST_POST_RESPONSE)
calls = [mock.call(systems_uri, None, new1_boot_settings), calls = [mock.call(systems_uri, None, new1_boot_settings),
@ -2252,12 +2269,14 @@ class TestRISOperationsPrivateMethods(testtools.TestCase):
ris_outputs.RESPONSE_BODY_FOR_REST_OP_WITH_ISCSI_AND_NONE)) ris_outputs.RESPONSE_BODY_FOR_REST_OP_WITH_ISCSI_AND_NONE))
systems_uri = '/rest/v1/Systems/1' systems_uri = '/rest/v1/Systems/1'
new1_boot_settings = {} new1_boot_settings = {}
new1_boot_settings['Boot'] = {'UefiTargetBootSourceOverride': new1_boot_settings['Boot'] = {
u'NIC.LOM.1.1.iSCSI'} 'UefiTargetBootSourceOverride': u'NIC.LOM.1.1.iSCSI'
}
new2_boot_settings = {} new2_boot_settings = {}
new2_boot_settings['Boot'] = {'BootSourceOverrideEnabled': new2_boot_settings['Boot'] = {
'Continuous', 'BootSourceOverrideTarget': 'BootSourceOverrideEnabled': 'Continuous',
'UefiTarget'} 'BootSourceOverrideTarget': 'UefiTarget'
}
rest_patch_mock.return_value = (200, ris_outputs.GET_HEADERS, rest_patch_mock.return_value = (200, ris_outputs.GET_HEADERS,
ris_outputs.REST_POST_RESPONSE) ris_outputs.REST_POST_RESPONSE)
@ -2272,7 +2291,7 @@ class TestRISOperationsPrivateMethods(testtools.TestCase):
get_host_mock.return_value = ( get_host_mock.return_value = (
json.loads(ris_outputs.RESPONSE_BODY_FOR_REST_OP)) json.loads(ris_outputs.RESPONSE_BODY_FOR_REST_OP))
self.assertRaisesRegex(exception.IloError, "No UEFI iSCSI bootable " self.assertRaisesRegex(exception.IloError, "No UEFI iSCSI bootable "
"device found", "device found",
self.client._update_persistent_boot, self.client._update_persistent_boot,
['ISCSI'], persistent=True) ['ISCSI'], persistent=True)
@ -2747,24 +2766,24 @@ class TestRISOperationsPrivateMethods(testtools.TestCase):
ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True} ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True}
raid_config = {"logical_disks": [ld1]} raid_config = {"logical_disks": [ld1]}
product_name_mock.return_value = 'ProLiant BL460c Gen9' product_name_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'ProLiant BL460c Gen9', 'ProLiant BL460c Gen9',
self.client.read_raid_configuration, self.client.read_raid_configuration,
raid_config) raid_config)
@mock.patch.object(ris.RISOperations, 'get_product_name') @mock.patch.object(ris.RISOperations, 'get_product_name')
def test_delete_raid_configuration(self, product_name_mock): def test_delete_raid_configuration(self, product_name_mock):
product_name_mock.return_value = 'ProLiant BL460c Gen9' product_name_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'ProLiant BL460c Gen9', 'ProLiant BL460c Gen9',
self.client.delete_raid_configuration) self.client.delete_raid_configuration)
@mock.patch.object(ris.RISOperations, 'get_product_name') @mock.patch.object(ris.RISOperations, 'get_product_name')
def test_create_raid_configuration(self, product_name_mock): def test_create_raid_configuration(self, product_name_mock):
ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True} ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True}
raid_config = {"logical_disks": [ld1]} raid_config = {"logical_disks": [ld1]}
product_name_mock.return_value = 'ProLiant BL460c Gen9' product_name_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError, self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'ProLiant BL460c Gen9', 'ProLiant BL460c Gen9',
self.client.create_raid_configuration, self.client.create_raid_configuration,
raid_config) raid_config)

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
import sys import sys
from unittest import mock
import mock
from oslo_utils import importutils from oslo_utils import importutils
import six import six

View File

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from oslo_utils import importutils from oslo_utils import importutils
import testtools import testtools

View File

@ -15,8 +15,8 @@
__author__ = 'HPE' __author__ = 'HPE'
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.account_service import account from proliantutils.redfish.resources.account_service import account

View File

@ -15,8 +15,8 @@
__author__ = 'HPE' __author__ = 'HPE'
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.account_service import account from proliantutils.redfish.resources.account_service import account

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.chassis import chassis from proliantutils.redfish.resources.chassis import chassis

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.chassis import devices from proliantutils.redfish.resources.chassis import devices

View File

@ -14,8 +14,8 @@
"""Test Class for HttpsCertTestCase""" """Test Class for HttpsCertTestCase"""
import json import json
from unittest import mock
import mock
import sushy import sushy
import testtools import testtools

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.manager import manager from proliantutils.redfish.resources.manager import manager

View File

@ -14,8 +14,8 @@
"""Test Class for SecurityDashboard.""" """Test Class for SecurityDashboard."""
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.manager import security_dashboard from proliantutils.redfish.resources.manager import security_dashboard

View File

@ -14,8 +14,8 @@
"""Test Class for SecurityParamsTestCase""" """Test Class for SecurityParamsTestCase"""
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.manager import security_params from proliantutils.redfish.resources.manager import security_params

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.manager import security_service from proliantutils.redfish.resources.manager import security_service

View File

@ -15,8 +15,8 @@
__author__ = 'HPE' __author__ = 'HPE'
import json import json
from unittest import mock
import mock
from sushy import exceptions from sushy import exceptions
from sushy.resources.manager import virtual_media as sushy_virt_media from sushy.resources.manager import virtual_media as sushy_virt_media
import testtools import testtools

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.system.storage import array_controller from proliantutils.redfish.resources.system.storage import array_controller

View File

@ -13,8 +13,9 @@
# under the License. # under the License.
__author__ = 'HPE' __author__ = 'HPE'
from unittest import mock
import ddt import ddt
import mock
import sushy import sushy
import testtools import testtools

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.system.storage import constants from proliantutils.redfish.resources.system.storage import constants

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.system.storage import logical_drive from proliantutils.redfish.resources.system.storage import logical_drive

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.system.storage import physical_drive from proliantutils.redfish.resources.system.storage import physical_drive

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.system.storage import simple_storage from proliantutils.redfish.resources.system.storage import simple_storage

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.system.storage import array_controller from proliantutils.redfish.resources.system.storage import array_controller

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.system.storage import storage from proliantutils.redfish.resources.system.storage import storage

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.system.storage import volume from proliantutils.redfish.resources.system.storage import volume

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import sushy import sushy
import testtools import testtools

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import sushy import sushy
import testtools import testtools

View File

@ -14,9 +14,9 @@
# under the License. # under the License.
import json import json
from unittest import mock
import ddt import ddt
import mock
import testtools import testtools
from proliantutils.redfish.resources.system import iscsi from proliantutils.redfish.resources.system import iscsi

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.system import constants from proliantutils.redfish.resources.system import constants

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.system import pci_device from proliantutils.redfish.resources.system import pci_device

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils import exception from proliantutils import exception

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils import exception from proliantutils import exception
@ -179,7 +179,7 @@ class HPESmartStorageConfigTestCase(testtools.TestCase):
type(self.ssc_inst).physical_drives = mock.PropertyMock( type(self.ssc_inst).physical_drives = mock.PropertyMock(
return_value=physical_drive) return_value=physical_drive)
message_mock.return_value = False, 'err_mesg' message_mock.return_value = False, 'err_mesg'
self.assertRaisesRegexp( self.assertRaisesRegex(
exception.IloError, exception.IloError,
'Failed to perform the create_raid operation successfully', 'Failed to perform the create_raid operation successfully',
self.ssc_inst.read_raid, ld1['controller']) self.ssc_inst.read_raid, ld1['controller'])

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import sushy import sushy
from sushy.resources.system import system as sushy_system from sushy.resources.system import system as sushy_system
import testtools import testtools
@ -613,7 +613,7 @@ class HPESystemTestCase(testtools.TestCase):
parse_raid_config_mock.return_value = parse_data parse_raid_config_mock.return_value = parse_data
check_smart_storage_config_ids_mock.return_value = None check_smart_storage_config_ids_mock.return_value = None
get_smart_storage_config_model_mock.return_value = None get_smart_storage_config_model_mock.return_value = None
self.assertRaisesRegexp( self.assertRaisesRegex(
exception.IloError, exception.IloError,
"The Redfish controller failed to create the raid " "The Redfish controller failed to create the raid "
"configuration for one or more controllers with", "configuration for one or more controllers with",
@ -712,7 +712,7 @@ class HPESystemTestCase(testtools.TestCase):
mock.PropertyMock(return_value=config_id)) mock.PropertyMock(return_value=config_id))
get_smart_storage_config_mock.return_value.read_raid.side_effect = ( get_smart_storage_config_mock.return_value.read_raid.side_effect = (
sushy.exceptions.SushyError) sushy.exceptions.SushyError)
self.assertRaisesRegexp( self.assertRaisesRegex(
exception.IloError, exception.IloError,
"The Redfish controller failed to read the " "The Redfish controller failed to read the "
"raid configuration in one or more controllers with Error:", "raid configuration in one or more controllers with Error:",
@ -736,7 +736,7 @@ class HPESystemTestCase(testtools.TestCase):
parse_raid_config_mock.return_value = parse_data parse_raid_config_mock.return_value = parse_data
(get_smart_storage_config_model_mock. (get_smart_storage_config_model_mock.
return_value.create_raid.side_effect) = sushy.exceptions.SushyError return_value.create_raid.side_effect) = sushy.exceptions.SushyError
self.assertRaisesRegexp( self.assertRaisesRegex(
exception.IloError, exception.IloError,
"The Redfish controller failed to create the " "The Redfish controller failed to create the "
"raid configuration for one or more controllers with Error:", "raid configuration for one or more controllers with Error:",
@ -800,7 +800,7 @@ class HPESystemTestCase(testtools.TestCase):
parse_raid_config_data_mock.return_value = parse_data parse_raid_config_data_mock.return_value = parse_data
(get_ssc_by_controller_model_mock. (get_ssc_by_controller_model_mock.
return_value.read_raid.side_effect) = sushy.exceptions.SushyError return_value.read_raid.side_effect) = sushy.exceptions.SushyError
self.assertRaisesRegexp( self.assertRaisesRegex(
exception.IloError, exception.IloError,
"The Redfish controller failed to read the " "The Redfish controller failed to read the "
"raid configuration in one or more controllers with Error:", "raid configuration in one or more controllers with Error:",
@ -895,7 +895,7 @@ class HPESystemTestCase(testtools.TestCase):
self.conn.get.return_value.json.reset_mock() self.conn.get.return_value.json.reset_mock()
(self.conn.get.return_value. (self.conn.get.return_value.
json.side_effect) = [ss_json, sushy.exceptions.SushyError] json.side_effect) = [ss_json, sushy.exceptions.SushyError]
self.assertRaisesRegexp( self.assertRaisesRegex(
exception.IloError, exception.IloError,
"The Redfish controller failed to get the status of sanitize disk " "The Redfish controller failed to get the status of sanitize disk "
"erase. Error:", "erase. Error:",
@ -924,7 +924,7 @@ class HPESystemTestCase(testtools.TestCase):
'#HpeComputerSystemExt.SecureSystemErase') '#HpeComputerSystemExt.SecureSystemErase')
type(secure_erase_action_mock.return_value).target_uri = target_uri type(secure_erase_action_mock.return_value).target_uri = target_uri
self.sys_inst._conn.post.side_effect = sushy.exceptions.SushyError self.sys_inst._conn.post.side_effect = sushy.exceptions.SushyError
self.assertRaisesRegexp( self.assertRaisesRegex(
exception.IloError, exception.IloError,
"The Redfish controller failed to perform one button " "The Redfish controller failed to perform one button "
"secure erase operation on the hardware. Error:", "secure erase operation on the hardware. Error:",
@ -1095,7 +1095,7 @@ class HPESystemTestCase(testtools.TestCase):
self.conn.get.return_value.json.reset_mock() self.conn.get.return_value.json.reset_mock()
(self.conn.get.return_value. (self.conn.get.return_value.
json.side_effect) = [ss_json, acc_json, sushy.exceptions.SushyError] json.side_effect) = [ss_json, acc_json, sushy.exceptions.SushyError]
self.assertRaisesRegexp( self.assertRaisesRegex(
exception.IloError, exception.IloError,
"The Redfish controller failed to perform the sanitize disk erase " "The Redfish controller failed to perform the sanitize disk erase "
"on smart storage controller: HPE Smart Array P408i-p SR Gen10, " "on smart storage controller: HPE Smart Array P408i-p SR Gen10, "

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils.redfish.resources.system import tls_config from proliantutils.redfish.resources.system import tls_config

View File

@ -13,8 +13,9 @@
# under the License. # under the License.
__author__ = 'HPE' __author__ = 'HPE'
from unittest import mock
import ddt import ddt
import mock
import sushy import sushy
import testtools import testtools

View File

@ -15,8 +15,8 @@
import json import json
import time import time
from unittest import mock
import mock
import sushy import sushy
import testtools import testtools

View File

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from sushy import connector from sushy import connector
from sushy import exceptions from sushy import exceptions
import testtools import testtools

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import json import json
from unittest import mock
import mock
import testtools import testtools
from proliantutils import exception from proliantutils import exception

View File

@ -19,9 +19,9 @@ import collections
import io import io
import json import json
import os import os
from unittest import mock
import ddt import ddt
import mock
import sushy import sushy
from sushy.resources.system import system from sushy.resources.system import system
import testtools import testtools

View File

@ -16,9 +16,9 @@
"""Test class for Utils Module.""" """Test class for Utils Module."""
import json import json
from unittest import mock
import ddt import ddt
import mock
import testtools import testtools
from proliantutils import exception from proliantutils import exception

View File

@ -14,8 +14,8 @@
import base64 import base64
import json import json
from unittest import mock
import mock
import requests import requests
from requests.packages import urllib3 from requests.packages import urllib3
from requests.packages.urllib3 import exceptions as urllib3_exceptions from requests.packages.urllib3 import exceptions as urllib3_exceptions

View File

@ -17,8 +17,8 @@ import shutil
import tarfile import tarfile
import tempfile import tempfile
import time import time
from unittest import mock
import mock
from oslo_concurrency import processutils from oslo_concurrency import processutils
from oslo_serialization import base64 from oslo_serialization import base64
import testtools import testtools

View File

@ -15,8 +15,8 @@
"""Test class for Utils Module.""" """Test class for Utils Module."""
import hashlib import hashlib
from unittest import mock
import mock
import requests import requests
import six import six
import six.moves.builtins as __builtin__ import six.moves.builtins as __builtin__

View File

@ -19,9 +19,8 @@ classifier =
Programming Language :: Python Programming Language :: Python
Programming Language :: Python :: 3 Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
[files] [files]
packages = packages =

View File

@ -1,10 +1,9 @@
# linters # The order of packages is significant, because pip processes them in the order
hacking>=3.0.0,<3.1.0 # Apache-2.0 # of appearance. Changing the order has an impact on the overall integration
flake8-import-order>=0.17.1 # LGPLv3 # process, which may cause wedges in the gate later.
mock coverage!=4.4,>=4.0 # Apache-2.0
coverage>=3.6 # Apache-2.0 stestr>=2.0.0,!=2.3.0,!=3.0.0 # Apache-2.0
stestr!=2.3.0 # Apache-2.0 testtools>=2.2.0 # MIT
testtools>=1.4.0 # MIT ddt>=1.2.2 # MIT
ddt xmltodict>=0.12.0 # MIT
xmltodict

View File

@ -1,5 +1,5 @@
[tox] [tox]
minversion = 3.1.0 minversion = 3.18.0
skipsdist = True skipsdist = True
envlist = py3,pep8 envlist = py3,pep8
ignore_basepython_conflict=true ignore_basepython_conflict=true
@ -22,6 +22,11 @@ commands =
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[testenv:pep8] [testenv:pep8]
deps =
hacking>=4.1.0,<5.0.0 # Apache-2.0
flake8-import-order>=0.17.1 # LGPLv3
pycodestyle>=2.0.0,<3.0.0 # MIT
Pygments>=2.2.0 # BSD
commands = flake8 {posargs} commands = flake8 {posargs}
[testenv:cover] [testenv:cover]