Update testing to yoga
Update jobs and requirements to yoga Also fix tests where needed Change-Id: I5dbf28d0ac77d81cc8f79496777aa15be3c52dd0
This commit is contained in:
parent
500f518d40
commit
682eb63985
@ -1,4 +1,4 @@
|
||||
- project:
|
||||
templates:
|
||||
- openstack-python3-victoria-jobs
|
||||
- openstack-python3-yoga-jobs
|
||||
- openstack-cover-jobs
|
||||
|
@ -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
|
||||
|
@ -13,8 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from proliantutils import exception
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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,7 +897,7 @@ 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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'`delete_raid_configuration` is not supported '
|
||||
'on ProLiant BL460c Gen9',
|
||||
self.client.delete_raid_configuration)
|
||||
@ -909,7 +906,7 @@ class IloClientTestCase(testtools.TestCase):
|
||||
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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'`delete_raid_configuration` is not supported '
|
||||
'on ProLiant DL380 G8',
|
||||
self.client.delete_raid_configuration)
|
||||
@ -924,7 +921,7 @@ 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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'The specified operation is not supported '
|
||||
'on current platform.',
|
||||
self.client.do_disk_erase,
|
||||
@ -934,7 +931,7 @@ class IloClientTestCase(testtools.TestCase):
|
||||
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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'The specified operation is not supported '
|
||||
'on current platform.',
|
||||
self.client.do_disk_erase,
|
||||
@ -949,7 +946,7 @@ 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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'The specified operation is not supported '
|
||||
'on current platform.',
|
||||
self.client.do_one_button_secure_erase)
|
||||
@ -958,7 +955,7 @@ class IloClientTestCase(testtools.TestCase):
|
||||
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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'The specified operation is not supported '
|
||||
'on current platform.',
|
||||
self.client.do_one_button_secure_erase)
|
||||
@ -972,7 +969,7 @@ 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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'The specified operation is not supported '
|
||||
'on current platform.',
|
||||
self.client.has_disk_erase_completed)
|
||||
@ -981,7 +978,7 @@ class IloClientTestCase(testtools.TestCase):
|
||||
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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'The specified operation is not supported '
|
||||
'on current platform.',
|
||||
self.client.has_disk_erase_completed)
|
||||
@ -1000,7 +997,7 @@ 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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'`create_raid_configuration` is not supported '
|
||||
'on ProLiant BL460c Gen9',
|
||||
self.client.create_raid_configuration,
|
||||
@ -1012,7 +1009,7 @@ 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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'`create_raid_configuration` is not supported '
|
||||
'on ProLiant DL380 G8',
|
||||
self.client.create_raid_configuration,
|
||||
@ -1032,7 +1029,7 @@ 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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'`read_raid_configuration` is not supported '
|
||||
'on ProLiant BL460c Gen9',
|
||||
self.client.read_raid_configuration,
|
||||
@ -1044,7 +1041,7 @@ 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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'`read_raid_configuration` is not supported '
|
||||
'on ProLiant DL380 G8',
|
||||
self.client.read_raid_configuration,
|
||||
@ -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,7 +1344,7 @@ 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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'not supported',
|
||||
self.client.inject_nmi)
|
||||
|
||||
@ -1383,7 +1379,7 @@ 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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'not supported',
|
||||
self.client.get_bios_settings_result)
|
||||
|
||||
@ -1396,7 +1392,7 @@ 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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'not supported',
|
||||
self.client.get_available_disk_types)
|
||||
|
||||
@ -1404,7 +1400,7 @@ class IloClientTestCase(testtools.TestCase):
|
||||
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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'not supported',
|
||||
self.client.get_available_disk_types)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
@ -1056,14 +1060,14 @@ 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,
|
||||
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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'ProLiant DL380 G7',
|
||||
self.ilo.get_host_post_state)
|
||||
|
||||
@ -1072,7 +1076,7 @@ class IloRibclTestCaseBeforeRisSupport(unittest.TestCase):
|
||||
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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'ProLiant DL380 G7',
|
||||
self.ilo.read_raid_configuration,
|
||||
raid_config)
|
||||
@ -1080,7 +1084,7 @@ class IloRibclTestCaseBeforeRisSupport(unittest.TestCase):
|
||||
@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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'ProLiant DL380 G7',
|
||||
self.ilo.delete_raid_configuration)
|
||||
|
||||
@ -1089,7 +1093,7 @@ class IloRibclTestCaseBeforeRisSupport(unittest.TestCase):
|
||||
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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'ProLiant DL380 G7',
|
||||
self.ilo.create_raid_configuration,
|
||||
raid_config)
|
||||
@ -1097,7 +1101,7 @@ class IloRibclTestCaseBeforeRisSupport(unittest.TestCase):
|
||||
@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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'ProLiant DL380 G7',
|
||||
self.ilo.get_bios_settings_result)
|
||||
|
||||
|
@ -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':
|
||||
properties = {
|
||||
'iSCSITargetName':
|
||||
'iqn.2011-07.com.example.server:test1',
|
||||
'iSCSIBootLUN': '1',
|
||||
'iSCSITargetIpAddress': '10.10.1.30',
|
||||
'iSCSITargetTcpPort': 3260}
|
||||
'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':
|
||||
properties = {
|
||||
'iSCSITargetName':
|
||||
'iqn.2011-07.com.example.server:test1',
|
||||
'iSCSIBootLUN': '1',
|
||||
'iSCSITargetIpAddress': '10.10.1.30',
|
||||
'iSCSITargetTcpPort': 3260}
|
||||
'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':
|
||||
properties = {
|
||||
'iSCSITargetName':
|
||||
'iqn.2011-07.com.example.server:test1',
|
||||
'iSCSIBootLUN': '1',
|
||||
'iSCSITargetIpAddress': '10.10.1.30',
|
||||
'iSCSITargetTcpPort': 3260}
|
||||
'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)
|
||||
@ -2747,7 +2766,7 @@ 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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'ProLiant BL460c Gen9',
|
||||
self.client.read_raid_configuration,
|
||||
raid_config)
|
||||
@ -2755,7 +2774,7 @@ class TestRISOperationsPrivateMethods(testtools.TestCase):
|
||||
@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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'ProLiant BL460c Gen9',
|
||||
self.client.delete_raid_configuration)
|
||||
|
||||
@ -2764,7 +2783,7 @@ 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,
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedError,
|
||||
'ProLiant BL460c Gen9',
|
||||
self.client.create_raid_configuration,
|
||||
raid_config)
|
||||
|
@ -13,8 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
import sys
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
__author__ = 'HPE'
|
||||
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from proliantutils.redfish.resources.account_service import account
|
||||
|
@ -15,8 +15,8 @@
|
||||
__author__ = 'HPE'
|
||||
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from proliantutils.redfish.resources.account_service import account
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from proliantutils.redfish.resources.chassis import chassis
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from proliantutils.redfish.resources.chassis import devices
|
||||
|
@ -14,8 +14,8 @@
|
||||
"""Test Class for HttpsCertTestCase"""
|
||||
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import sushy
|
||||
import testtools
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from proliantutils.redfish.resources.manager import manager
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -13,8 +13,9 @@
|
||||
# under the License.
|
||||
__author__ = 'HPE'
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import ddt
|
||||
import mock
|
||||
import sushy
|
||||
import testtools
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import sushy
|
||||
import testtools
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import sushy
|
||||
import testtools
|
||||
|
||||
|
@ -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
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from proliantutils.redfish.resources.system import constants
|
||||
|
@ -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
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from proliantutils import exception
|
||||
|
@ -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'])
|
||||
|
@ -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, "
|
||||
|
@ -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
|
||||
|
@ -13,8 +13,9 @@
|
||||
# under the License.
|
||||
__author__ = 'HPE'
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import ddt
|
||||
import mock
|
||||
import sushy
|
||||
import testtools
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
import json
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import sushy
|
||||
import testtools
|
||||
|
||||
|
@ -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
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from proliantutils import exception
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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__
|
||||
|
@ -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 =
|
||||
|
@ -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
|
7
tox.ini
7
tox.ini
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user