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:
templates:
- openstack-python3-victoria-jobs
- openstack-python3-yoga-jobs
- openstack-cover-jobs

View File

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

View File

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

View File

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

View File

@ -12,9 +12,10 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# 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.tests.ilo.snmp import snmp_sample_output

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
"""Test class for Client Module."""
from unittest import mock
import mock
import testtools
from proliantutils import exception
@ -35,7 +35,6 @@ def get_cls_wrapper(cls, cache=True):
class IloCacheNodeTestCase(testtools.TestCase):
def test_cache_node_cache_true(self):
class Dummyclass1(object):
pass
@ -43,7 +42,6 @@ class IloCacheNodeTestCase(testtools.TestCase):
self.assertNotEqual(id(original_cls), id(decorated_cls))
def test_cache_node_cache_false(self):
class Dummyclass2(object):
pass
@ -53,7 +51,6 @@ class IloCacheNodeTestCase(testtools.TestCase):
class IloClientWrapperTestCase(testtools.TestCase):
class DummyClass(object):
def __init__(self, ip, name, password):
self._ip = ip
@ -256,7 +253,6 @@ class IloClientInitTestCase(testtools.TestCase):
@mock.patch.object(redfish, 'RedfishOperations')
def test_init_with_use_redfish_only_set(
self, redfish_mock, ribcl_mock):
c = client.IloClient.cls("1.2.3.4", "admin", "Admin",
timeout=120, port=4430,
bios_password='foo', cacert='/somewhere',
@ -436,6 +432,7 @@ class IloClientTestCase(testtools.TestCase):
true | false | false | test__call_method_redfish_4
===========|==========|====================|=============================
"""
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
@mock.patch.object(redfish, 'RedfishOperations')
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):
self.client.model = 'Gen9'
get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'`delete_raid_configuration` is not supported '
'on ProLiant BL460c Gen9',
self.client.delete_raid_configuration)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'`delete_raid_configuration` is not supported '
'on ProLiant BL460c Gen9',
self.client.delete_raid_configuration)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_delete_raid_configuration_gen8(self, get_product_mock):
self.client.model = 'Gen8'
get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'`delete_raid_configuration` is not supported '
'on ProLiant DL380 G8',
self.client.delete_raid_configuration)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'`delete_raid_configuration` is not supported '
'on ProLiant DL380 G8',
self.client.delete_raid_configuration)
@mock.patch.object(client.IloClient.cls, '_call_method')
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):
self.client.model = 'Gen9'
get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'The specified operation is not supported '
'on current platform.',
self.client.do_disk_erase,
'SSD', None)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'The specified operation is not supported '
'on current platform.',
self.client.do_disk_erase,
'SSD', None)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_do_disk_erase_gen8(self, get_product_mock):
self.client.model = 'Gen8'
get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'The specified operation is not supported '
'on current platform.',
self.client.do_disk_erase,
'SSD', None)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'The specified operation is not supported '
'on current platform.',
self.client.do_disk_erase,
'SSD', None)
@mock.patch.object(client.IloClient.cls, '_call_method')
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):
self.client.model = 'Gen9'
get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'The specified operation is not supported '
'on current platform.',
self.client.do_one_button_secure_erase)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'The specified operation is not supported '
'on current platform.',
self.client.do_one_button_secure_erase)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_do_one_button_secure_erase_gen8(self, get_product_mock):
self.client.model = 'Gen8'
get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'The specified operation is not supported '
'on current platform.',
self.client.do_one_button_secure_erase)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'The specified operation is not supported '
'on current platform.',
self.client.do_one_button_secure_erase)
@mock.patch.object(client.IloClient.cls, '_call_method')
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):
self.client.model = 'Gen9'
get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'The specified operation is not supported '
'on current platform.',
self.client.has_disk_erase_completed)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'The specified operation is not supported '
'on current platform.',
self.client.has_disk_erase_completed)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_has_disk_erase_completed_gen8(self, get_product_mock):
self.client.model = 'Gen8'
get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'The specified operation is not supported '
'on current platform.',
self.client.has_disk_erase_completed)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'The specified operation is not supported '
'on current platform.',
self.client.has_disk_erase_completed)
@mock.patch.object(client.IloClient.cls, '_call_method')
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}
raid_config = {"logical_disks": [ld1]}
get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'`create_raid_configuration` is not supported '
'on ProLiant BL460c Gen9',
self.client.create_raid_configuration,
raid_config)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'`create_raid_configuration` is not supported '
'on ProLiant BL460c Gen9',
self.client.create_raid_configuration,
raid_config)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
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}
raid_config = {"logical_disks": [ld1]}
get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'`create_raid_configuration` is not supported '
'on ProLiant DL380 G8',
self.client.create_raid_configuration,
raid_config)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'`create_raid_configuration` is not supported '
'on ProLiant DL380 G8',
self.client.create_raid_configuration,
raid_config)
@mock.patch.object(client.IloClient.cls, '_call_method')
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}
raid_config = {"logical_disks": [ld1]}
get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'`read_raid_configuration` is not supported '
'on ProLiant BL460c Gen9',
self.client.read_raid_configuration,
raid_config)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'`read_raid_configuration` is not supported '
'on ProLiant BL460c Gen9',
self.client.read_raid_configuration,
raid_config)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
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}
raid_config = {"logical_disks": [ld1]}
get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'`read_raid_configuration` is not supported '
'on ProLiant DL380 G8',
self.client.read_raid_configuration,
raid_config)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'`read_raid_configuration` is not supported '
'on ProLiant DL380 G8',
self.client.read_raid_configuration,
raid_config)
@mock.patch.object(ris.RISOperations, 'eject_virtual_media')
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')
def test_get_essential_prop_snmp_false_local_gb_0(self, call_mock,
snmp_mock):
self.client.model = 'Gen9'
snmp_credentials = {'auth_user': 'user',
'auth_prot_pp': '1234',
@ -1348,9 +1344,9 @@ class IloClientTestCase(testtools.TestCase):
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_inject_nmi_gen8(self, product_mock):
self.client.model = 'Gen8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'not supported',
self.client.inject_nmi)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'not supported',
self.client.inject_nmi)
@mock.patch.object(client.IloClient.cls, '_call_method')
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')
def test_get_bios_settings_result_gen8(self, product_mock):
self.client.model = 'Gen8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'not supported',
self.client.get_bios_settings_result)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'not supported',
self.client.get_bios_settings_result)
@mock.patch.object(client.IloClient.cls, '_call_method')
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):
self.client.model = 'Gen9'
get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'not supported',
self.client.get_available_disk_types)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'not supported',
self.client.get_available_disk_types)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_get_available_disk_types_gen8(self, get_product_mock):
self.client.model = 'Gen8'
get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'not supported',
self.client.get_available_disk_types)
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
'not supported',
self.client.get_available_disk_types)
class IloRedfishClientTestCase(testtools.TestCase):
@ -1453,7 +1449,7 @@ class IloRedfishClientTestCase(testtools.TestCase):
validate_method_calls(
more_missed_operations, ('arg1', 'arg2'),
even_more_missed_operations)
if(len(even_more_missed_operations) == 1):
if (len(even_more_missed_operations) == 1):
self.assertEqual('set_iscsi_info',
even_more_missed_operations[0])
else:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
[tox]
minversion = 3.1.0
minversion = 3.18.0
skipsdist = True
envlist = py3,pep8
ignore_basepython_conflict=true
@ -22,6 +22,11 @@ commands =
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[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}
[testenv:cover]