'Test type extraction from perf_class with Regex'

@mock.patch('cinder.volume.drivers.ibm.ibm_storage.xiv_proxy.XIVProxy._qos_create_kwargs_for_xcli', mock.MagicMock(return_value={}))
def test_regex_from_perf_class_name(self):

    driver = mock.MagicMock()
    driver.VERSION = 'VERSION'
    p = self.proxy(self.default_storage_info, mock.MagicMock(), test_mock.cinder.exception, driver)
    perf_class_names_list = [{'class_name': 'cinder-qos_iops_1000_type_independent_bw_1000', 'type': 'independent'}, {'class_name': 'cinder-qos_iops_1000_bw_1000_type_shared', 'type': 'shared'}, {'class_name': 'cinder-qos_type_badtype_bw_1000', 'type': None}]
    for element in perf_class_names_list:
        _type = p._get_type_from_perf_class_name(perf_class_name=element['class_name'])
        self.assertEqual(element['type'], _type)
