tests: Rename 'FakeType' -> 'FakeVolumeType'
There are more types than just volume types. Change-Id: I6af66f966a221437ff79fabcb0b81fd38586fe67 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
@@ -400,12 +400,12 @@ class TestVolumev1(utils.TestCommand):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class FakeType(object):
|
class FakeVolumeType(object):
|
||||||
"""Fake one or more type."""
|
"""Fake one or more type."""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_one_type(attrs=None, methods=None):
|
def create_one_volume_type(attrs=None, methods=None):
|
||||||
"""Create a fake type.
|
"""Create a fake volume type.
|
||||||
|
|
||||||
:param Dictionary attrs:
|
:param Dictionary attrs:
|
||||||
A dictionary with all attributes
|
A dictionary with all attributes
|
||||||
@@ -418,7 +418,7 @@ class FakeType(object):
|
|||||||
methods = methods or {}
|
methods = methods or {}
|
||||||
|
|
||||||
# Set default attributes.
|
# Set default attributes.
|
||||||
type_info = {
|
volume_type_info = {
|
||||||
"id": 'type-id-' + uuid.uuid4().hex,
|
"id": 'type-id-' + uuid.uuid4().hex,
|
||||||
"name": 'type-name-' + uuid.uuid4().hex,
|
"name": 'type-name-' + uuid.uuid4().hex,
|
||||||
"description": 'type-description-' + uuid.uuid4().hex,
|
"description": 'type-description-' + uuid.uuid4().hex,
|
||||||
@@ -427,16 +427,16 @@ class FakeType(object):
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Overwrite default attributes.
|
# Overwrite default attributes.
|
||||||
type_info.update(attrs)
|
volume_type_info.update(attrs)
|
||||||
|
|
||||||
volume_type = fakes.FakeResource(
|
volume_type = fakes.FakeResource(
|
||||||
info=copy.deepcopy(type_info),
|
info=copy.deepcopy(volume_type_info),
|
||||||
methods=methods,
|
methods=methods,
|
||||||
loaded=True)
|
loaded=True)
|
||||||
return volume_type
|
return volume_type
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_types(attrs=None, count=2):
|
def create_volume_types(attrs=None, count=2):
|
||||||
"""Create multiple fake types.
|
"""Create multiple fake types.
|
||||||
|
|
||||||
:param Dictionary attrs:
|
:param Dictionary attrs:
|
||||||
@@ -448,19 +448,19 @@ class FakeType(object):
|
|||||||
"""
|
"""
|
||||||
volume_types = []
|
volume_types = []
|
||||||
for i in range(0, count):
|
for i in range(0, count):
|
||||||
volume_type = FakeType.create_one_type(attrs)
|
volume_type = FakeVolumeType.create_one_volume_type(attrs)
|
||||||
volume_types.append(volume_type)
|
volume_types.append(volume_type)
|
||||||
|
|
||||||
return volume_types
|
return volume_types
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_types(types=None, count=2):
|
def get_volume_types(volume_types=None, count=2):
|
||||||
"""Get an iterable MagicMock object with a list of faked types.
|
"""Get an iterable MagicMock object with a list of faked types.
|
||||||
|
|
||||||
If types list is provided, then initialize the Mock object with the
|
If types list is provided, then initialize the Mock object with the
|
||||||
list. Otherwise create one.
|
list. Otherwise create one.
|
||||||
|
|
||||||
:param List types:
|
:param List volume_types:
|
||||||
A list of FakeResource objects faking types
|
A list of FakeResource objects faking types
|
||||||
:param Integer count:
|
:param Integer count:
|
||||||
The number of types to be faked
|
The number of types to be faked
|
||||||
@@ -468,14 +468,14 @@ class FakeType(object):
|
|||||||
An iterable Mock object with side_effect set to a list of faked
|
An iterable Mock object with side_effect set to a list of faked
|
||||||
types
|
types
|
||||||
"""
|
"""
|
||||||
if types is None:
|
if volume_types is None:
|
||||||
types = FakeType.create_types(count)
|
volume_types = FakeVolumeType.create_volume_types(count)
|
||||||
|
|
||||||
return mock.Mock(side_effect=types)
|
return mock.Mock(side_effect=volume_types)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_one_encryption_type(attrs=None):
|
def create_one_encryption_volume_type(attrs=None):
|
||||||
"""Create a fake encryption type.
|
"""Create a fake encryption volume type.
|
||||||
|
|
||||||
:param Dictionary attrs:
|
:param Dictionary attrs:
|
||||||
A dictionary with all attributes
|
A dictionary with all attributes
|
||||||
|
@@ -39,7 +39,7 @@ class TestQos(volume_fakes.TestVolumev1):
|
|||||||
|
|
||||||
class TestQosAssociate(TestQos):
|
class TestQosAssociate(TestQos):
|
||||||
|
|
||||||
volume_type = volume_fakes.FakeType.create_one_type()
|
volume_type = volume_fakes.FakeVolumeType.create_one_volume_type()
|
||||||
qos_spec = volume_fakes.FakeQos.create_one_qos()
|
qos_spec = volume_fakes.FakeQos.create_one_qos()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@@ -263,7 +263,7 @@ class TestQosDelete(TestQos):
|
|||||||
|
|
||||||
class TestQosDisassociate(TestQos):
|
class TestQosDisassociate(TestQos):
|
||||||
|
|
||||||
volume_type = volume_fakes.FakeType.create_one_type()
|
volume_type = volume_fakes.FakeVolumeType.create_one_volume_type()
|
||||||
qos_spec = volume_fakes.FakeQos.create_one_qos()
|
qos_spec = volume_fakes.FakeQos.create_one_qos()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@@ -49,9 +49,9 @@ class TestTypeCreate(TestType):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTypeCreate, self).setUp()
|
super(TestTypeCreate, self).setUp()
|
||||||
|
|
||||||
self.new_volume_type = volume_fakes.FakeType.create_one_type(
|
self.new_volume_type = \
|
||||||
methods={'set_keys': {'myprop': 'myvalue'}}
|
volume_fakes.FakeVolumeType.create_one_volume_type(
|
||||||
)
|
methods={'set_keys': {'myprop': 'myvalue'}})
|
||||||
self.data = (
|
self.data = (
|
||||||
self.new_volume_type.description,
|
self.new_volume_type.description,
|
||||||
self.new_volume_type.id,
|
self.new_volume_type.id,
|
||||||
@@ -87,10 +87,11 @@ class TestTypeCreate(TestType):
|
|||||||
'key_size': '128',
|
'key_size': '128',
|
||||||
'control_location': 'front-end',
|
'control_location': 'front-end',
|
||||||
}
|
}
|
||||||
encryption_type = volume_fakes.FakeType.create_one_encryption_type(
|
encryption_type = \
|
||||||
attrs=encryption_info
|
volume_fakes.FakeVolumeType.create_one_encryption_volume_type(
|
||||||
)
|
attrs=encryption_info)
|
||||||
self.new_volume_type = volume_fakes.FakeType.create_one_type(
|
self.new_volume_type = \
|
||||||
|
volume_fakes.FakeVolumeType.create_one_volume_type(
|
||||||
attrs={'encryption': encryption_info})
|
attrs={'encryption': encryption_info})
|
||||||
self.types_mock.create.return_value = self.new_volume_type
|
self.types_mock.create.return_value = self.new_volume_type
|
||||||
self.encryption_types_mock.create.return_value = encryption_type
|
self.encryption_types_mock.create.return_value = encryption_type
|
||||||
@@ -144,12 +145,12 @@ class TestTypeCreate(TestType):
|
|||||||
|
|
||||||
class TestTypeDelete(TestType):
|
class TestTypeDelete(TestType):
|
||||||
|
|
||||||
volume_types = volume_fakes.FakeType.create_types(count=2)
|
volume_types = volume_fakes.FakeVolumeType.create_volume_types(count=2)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTypeDelete, self).setUp()
|
super(TestTypeDelete, self).setUp()
|
||||||
|
|
||||||
self.types_mock.get = volume_fakes.FakeType.get_types(
|
self.types_mock.get = volume_fakes.FakeVolumeType.get_volume_types(
|
||||||
self.volume_types)
|
self.volume_types)
|
||||||
self.types_mock.delete.return_value = None
|
self.types_mock.delete.return_value = None
|
||||||
|
|
||||||
@@ -220,7 +221,7 @@ class TestTypeDelete(TestType):
|
|||||||
|
|
||||||
class TestTypeList(TestType):
|
class TestTypeList(TestType):
|
||||||
|
|
||||||
volume_types = volume_fakes.FakeType.create_types()
|
volume_types = volume_fakes.FakeVolumeType.create_volume_types()
|
||||||
|
|
||||||
columns = [
|
columns = [
|
||||||
"ID",
|
"ID",
|
||||||
@@ -287,7 +288,8 @@ class TestTypeList(TestType):
|
|||||||
self.assertItemsEqual(self.data_long, list(data))
|
self.assertItemsEqual(self.data_long, list(data))
|
||||||
|
|
||||||
def test_type_list_with_encryption(self):
|
def test_type_list_with_encryption(self):
|
||||||
encryption_type = volume_fakes.FakeType.create_one_encryption_type(
|
encryption_type = \
|
||||||
|
volume_fakes.FakeVolumeType.create_one_encryption_volume_type(
|
||||||
attrs={'volume_type_id': self.volume_types[0].id})
|
attrs={'volume_type_id': self.volume_types[0].id})
|
||||||
encryption_info = {
|
encryption_info = {
|
||||||
'provider': 'LuksEncryptor',
|
'provider': 'LuksEncryptor',
|
||||||
@@ -333,7 +335,7 @@ class TestTypeList(TestType):
|
|||||||
|
|
||||||
class TestTypeSet(TestType):
|
class TestTypeSet(TestType):
|
||||||
|
|
||||||
volume_type = volume_fakes.FakeType.create_one_type(
|
volume_type = volume_fakes.FakeVolumeType.create_one_volume_type(
|
||||||
methods={'set_keys': None})
|
methods={'set_keys': None})
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@@ -441,7 +443,7 @@ class TestTypeShow(TestType):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTypeShow, self).setUp()
|
super(TestTypeShow, self).setUp()
|
||||||
|
|
||||||
self.volume_type = volume_fakes.FakeType.create_one_type()
|
self.volume_type = volume_fakes.FakeVolumeType.create_one_volume_type()
|
||||||
self.data = (
|
self.data = (
|
||||||
self.volume_type.description,
|
self.volume_type.description,
|
||||||
self.volume_type.id,
|
self.volume_type.id,
|
||||||
@@ -472,14 +474,15 @@ class TestTypeShow(TestType):
|
|||||||
self.assertItemsEqual(self.data, data)
|
self.assertItemsEqual(self.data, data)
|
||||||
|
|
||||||
def test_type_show_with_encryption(self):
|
def test_type_show_with_encryption(self):
|
||||||
encryption_type = volume_fakes.FakeType.create_one_encryption_type()
|
encryption_type = \
|
||||||
|
volume_fakes.FakeVolumeType.create_one_encryption_volume_type()
|
||||||
encryption_info = {
|
encryption_info = {
|
||||||
'provider': 'LuksEncryptor',
|
'provider': 'LuksEncryptor',
|
||||||
'cipher': None,
|
'cipher': None,
|
||||||
'key_size': None,
|
'key_size': None,
|
||||||
'control_location': 'front-end',
|
'control_location': 'front-end',
|
||||||
}
|
}
|
||||||
self.volume_type = volume_fakes.FakeType.create_one_type(
|
self.volume_type = volume_fakes.FakeVolumeType.create_one_volume_type(
|
||||||
attrs={'encryption': encryption_info})
|
attrs={'encryption': encryption_info})
|
||||||
self.types_mock.get.return_value = self.volume_type
|
self.types_mock.get.return_value = self.volume_type
|
||||||
self.encryption_types_mock.get.return_value = encryption_type
|
self.encryption_types_mock.get.return_value = encryption_type
|
||||||
@@ -518,7 +521,7 @@ class TestTypeShow(TestType):
|
|||||||
|
|
||||||
class TestTypeUnset(TestType):
|
class TestTypeUnset(TestType):
|
||||||
|
|
||||||
volume_type = volume_fakes.FakeType.create_one_type(
|
volume_type = volume_fakes.FakeVolumeType.create_one_volume_type(
|
||||||
methods={'unset_keys': None})
|
methods={'unset_keys': None})
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@@ -596,7 +599,7 @@ class TestTypeUnset(TestType):
|
|||||||
class TestColumns(TestType):
|
class TestColumns(TestType):
|
||||||
|
|
||||||
def test_encryption_info_column_with_info(self):
|
def test_encryption_info_column_with_info(self):
|
||||||
fake_volume_type = volume_fakes.FakeType.create_one_type()
|
fake_volume_type = volume_fakes.FakeVolumeType.create_one_volume_type()
|
||||||
type_id = fake_volume_type.id
|
type_id = fake_volume_type.id
|
||||||
|
|
||||||
encryption_info = {
|
encryption_info = {
|
||||||
@@ -612,7 +615,7 @@ class TestColumns(TestType):
|
|||||||
self.assertEqual(encryption_info, col.machine_readable())
|
self.assertEqual(encryption_info, col.machine_readable())
|
||||||
|
|
||||||
def test_encryption_info_column_without_info(self):
|
def test_encryption_info_column_without_info(self):
|
||||||
fake_volume_type = volume_fakes.FakeType.create_one_type()
|
fake_volume_type = volume_fakes.FakeVolumeType.create_one_volume_type()
|
||||||
type_id = fake_volume_type.id
|
type_id = fake_volume_type.id
|
||||||
|
|
||||||
col = volume_type.EncryptionInfoColumn(type_id, {})
|
col = volume_type.EncryptionInfoColumn(type_id, {})
|
||||||
|
@@ -983,12 +983,12 @@ class FakeSnapshot(object):
|
|||||||
return mock.Mock(side_effect=snapshots)
|
return mock.Mock(side_effect=snapshots)
|
||||||
|
|
||||||
|
|
||||||
class FakeType(object):
|
class FakeVolumeType(object):
|
||||||
"""Fake one or more type."""
|
"""Fake one or more volume type."""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_one_type(attrs=None, methods=None):
|
def create_one_volume_type(attrs=None, methods=None):
|
||||||
"""Create a fake type.
|
"""Create a fake volume type.
|
||||||
|
|
||||||
:param Dictionary attrs:
|
:param Dictionary attrs:
|
||||||
A dictionary with all attributes
|
A dictionary with all attributes
|
||||||
@@ -1001,7 +1001,7 @@ class FakeType(object):
|
|||||||
methods = methods or {}
|
methods = methods or {}
|
||||||
|
|
||||||
# Set default attributes.
|
# Set default attributes.
|
||||||
type_info = {
|
volume_type_info = {
|
||||||
"id": 'type-id-' + uuid.uuid4().hex,
|
"id": 'type-id-' + uuid.uuid4().hex,
|
||||||
"name": 'type-name-' + uuid.uuid4().hex,
|
"name": 'type-name-' + uuid.uuid4().hex,
|
||||||
"description": 'type-description-' + uuid.uuid4().hex,
|
"description": 'type-description-' + uuid.uuid4().hex,
|
||||||
@@ -1010,17 +1010,17 @@ class FakeType(object):
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Overwrite default attributes.
|
# Overwrite default attributes.
|
||||||
type_info.update(attrs)
|
volume_type_info.update(attrs)
|
||||||
|
|
||||||
volume_type = fakes.FakeResource(
|
volume_type = fakes.FakeResource(
|
||||||
info=copy.deepcopy(type_info),
|
info=copy.deepcopy(volume_type_info),
|
||||||
methods=methods,
|
methods=methods,
|
||||||
loaded=True)
|
loaded=True)
|
||||||
return volume_type
|
return volume_type
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_types(attrs=None, count=2):
|
def create_volume_types(attrs=None, count=2):
|
||||||
"""Create multiple fake types.
|
"""Create multiple fake volume_types.
|
||||||
|
|
||||||
:param Dictionary attrs:
|
:param Dictionary attrs:
|
||||||
A dictionary with all attributes
|
A dictionary with all attributes
|
||||||
@@ -1031,34 +1031,34 @@ class FakeType(object):
|
|||||||
"""
|
"""
|
||||||
volume_types = []
|
volume_types = []
|
||||||
for i in range(0, count):
|
for i in range(0, count):
|
||||||
volume_type = FakeType.create_one_type(attrs)
|
volume_type = FakeVolumeType.create_one_volume_type(attrs)
|
||||||
volume_types.append(volume_type)
|
volume_types.append(volume_type)
|
||||||
|
|
||||||
return volume_types
|
return volume_types
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_types(types=None, count=2):
|
def get_volume_types(volume_types=None, count=2):
|
||||||
"""Get an iterable MagicMock object with a list of faked types.
|
"""Get an iterable MagicMock object with a list of faked volume types.
|
||||||
|
|
||||||
If types list is provided, then initialize the Mock object with the
|
If volume_types list is provided, then initialize the Mock object with
|
||||||
list. Otherwise create one.
|
the list. Otherwise create one.
|
||||||
|
|
||||||
:param List types:
|
:param List volume_types:
|
||||||
A list of FakeResource objects faking types
|
A list of FakeResource objects faking volume types
|
||||||
:param Integer count:
|
:param Integer count:
|
||||||
The number of types to be faked
|
The number of volume types to be faked
|
||||||
:return
|
:return
|
||||||
An iterable Mock object with side_effect set to a list of faked
|
An iterable Mock object with side_effect set to a list of faked
|
||||||
types
|
volume types
|
||||||
"""
|
"""
|
||||||
if types is None:
|
if volume_types is None:
|
||||||
types = FakeType.create_types(count)
|
volume_types = FakeVolumeType.create_volume_types(count)
|
||||||
|
|
||||||
return mock.Mock(side_effect=types)
|
return mock.Mock(side_effect=volume_types)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_one_encryption_type(attrs=None):
|
def create_one_encryption_volume_type(attrs=None):
|
||||||
"""Create a fake encryption type.
|
"""Create a fake encryption volume type.
|
||||||
|
|
||||||
:param Dictionary attrs:
|
:param Dictionary attrs:
|
||||||
A dictionary with all attributes
|
A dictionary with all attributes
|
||||||
|
@@ -148,7 +148,7 @@ class TestConsistencyGroupAddVolume(TestConsistencyGroup):
|
|||||||
|
|
||||||
class TestConsistencyGroupCreate(TestConsistencyGroup):
|
class TestConsistencyGroupCreate(TestConsistencyGroup):
|
||||||
|
|
||||||
volume_type = volume_fakes.FakeType.create_one_type()
|
volume_type = volume_fakes.FakeVolumeType.create_one_volume_type()
|
||||||
new_consistency_group = (
|
new_consistency_group = (
|
||||||
volume_fakes.FakeConsistencyGroup.create_one_consistency_group())
|
volume_fakes.FakeConsistencyGroup.create_one_consistency_group())
|
||||||
consistency_group_snapshot = (
|
consistency_group_snapshot = (
|
||||||
|
@@ -39,7 +39,7 @@ class TestQos(volume_fakes.TestVolume):
|
|||||||
|
|
||||||
class TestQosAssociate(TestQos):
|
class TestQosAssociate(TestQos):
|
||||||
|
|
||||||
volume_type = volume_fakes.FakeType.create_one_type()
|
volume_type = volume_fakes.FakeVolumeType.create_one_volume_type()
|
||||||
qos_spec = volume_fakes.FakeQos.create_one_qos()
|
qos_spec = volume_fakes.FakeQos.create_one_qos()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@@ -255,7 +255,7 @@ class TestQosDelete(TestQos):
|
|||||||
|
|
||||||
class TestQosDisassociate(TestQos):
|
class TestQosDisassociate(TestQos):
|
||||||
|
|
||||||
volume_type = volume_fakes.FakeType.create_one_type()
|
volume_type = volume_fakes.FakeVolumeType.create_one_volume_type()
|
||||||
qos_spec = volume_fakes.FakeQos.create_one_qos()
|
qos_spec = volume_fakes.FakeQos.create_one_qos()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@@ -58,7 +58,8 @@ class TestTypeCreate(TestType):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTypeCreate, self).setUp()
|
super(TestTypeCreate, self).setUp()
|
||||||
|
|
||||||
self.new_volume_type = volume_fakes.FakeType.create_one_type()
|
self.new_volume_type = \
|
||||||
|
volume_fakes.FakeVolumeType.create_one_volume_type()
|
||||||
self.data = (
|
self.data = (
|
||||||
self.new_volume_type.description,
|
self.new_volume_type.description,
|
||||||
self.new_volume_type.id,
|
self.new_volume_type.id,
|
||||||
@@ -143,10 +144,11 @@ class TestTypeCreate(TestType):
|
|||||||
'key_size': '128',
|
'key_size': '128',
|
||||||
'control_location': 'front-end',
|
'control_location': 'front-end',
|
||||||
}
|
}
|
||||||
encryption_type = volume_fakes.FakeType.create_one_encryption_type(
|
encryption_type = \
|
||||||
attrs=encryption_info
|
volume_fakes.FakeVolumeType.create_one_encryption_volume_type(
|
||||||
)
|
attrs=encryption_info)
|
||||||
self.new_volume_type = volume_fakes.FakeType.create_one_type(
|
self.new_volume_type = \
|
||||||
|
volume_fakes.FakeVolumeType.create_one_volume_type(
|
||||||
attrs={'encryption': encryption_info})
|
attrs={'encryption': encryption_info})
|
||||||
self.types_mock.create.return_value = self.new_volume_type
|
self.types_mock.create.return_value = self.new_volume_type
|
||||||
self.encryption_types_mock.create.return_value = encryption_type
|
self.encryption_types_mock.create.return_value = encryption_type
|
||||||
@@ -201,12 +203,12 @@ class TestTypeCreate(TestType):
|
|||||||
|
|
||||||
class TestTypeDelete(TestType):
|
class TestTypeDelete(TestType):
|
||||||
|
|
||||||
volume_types = volume_fakes.FakeType.create_types(count=2)
|
volume_types = volume_fakes.FakeVolumeType.create_volume_types(count=2)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTypeDelete, self).setUp()
|
super(TestTypeDelete, self).setUp()
|
||||||
|
|
||||||
self.types_mock.get = volume_fakes.FakeType.get_types(
|
self.types_mock.get = volume_fakes.FakeVolumeType.get_volume_types(
|
||||||
self.volume_types)
|
self.volume_types)
|
||||||
self.types_mock.delete.return_value = None
|
self.types_mock.delete.return_value = None
|
||||||
|
|
||||||
@@ -276,7 +278,7 @@ class TestTypeDelete(TestType):
|
|||||||
|
|
||||||
class TestTypeList(TestType):
|
class TestTypeList(TestType):
|
||||||
|
|
||||||
volume_types = volume_fakes.FakeType.create_types()
|
volume_types = volume_fakes.FakeVolumeType.create_volume_types()
|
||||||
|
|
||||||
columns = [
|
columns = [
|
||||||
"ID",
|
"ID",
|
||||||
@@ -386,7 +388,8 @@ class TestTypeList(TestType):
|
|||||||
self.assertItemsEqual(self.data_with_default_type, list(data))
|
self.assertItemsEqual(self.data_with_default_type, list(data))
|
||||||
|
|
||||||
def test_type_list_with_encryption(self):
|
def test_type_list_with_encryption(self):
|
||||||
encryption_type = volume_fakes.FakeType.create_one_encryption_type(
|
encryption_type = \
|
||||||
|
volume_fakes.FakeVolumeType.create_one_encryption_volume_type(
|
||||||
attrs={'volume_type_id': self.volume_types[0].id})
|
attrs={'volume_type_id': self.volume_types[0].id})
|
||||||
encryption_info = {
|
encryption_info = {
|
||||||
'provider': 'LuksEncryptor',
|
'provider': 'LuksEncryptor',
|
||||||
@@ -433,7 +436,7 @@ class TestTypeList(TestType):
|
|||||||
class TestTypeSet(TestType):
|
class TestTypeSet(TestType):
|
||||||
|
|
||||||
project = identity_fakes.FakeProject.create_one_project()
|
project = identity_fakes.FakeProject.create_one_project()
|
||||||
volume_type = volume_fakes.FakeType.create_one_type(
|
volume_type = volume_fakes.FakeVolumeType.create_one_volume_type(
|
||||||
methods={'set_keys': None})
|
methods={'set_keys': None})
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@@ -684,7 +687,7 @@ class TestTypeShow(TestType):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTypeShow, self).setUp()
|
super(TestTypeShow, self).setUp()
|
||||||
|
|
||||||
self.volume_type = volume_fakes.FakeType.create_one_type()
|
self.volume_type = volume_fakes.FakeVolumeType.create_one_volume_type()
|
||||||
self.data = (
|
self.data = (
|
||||||
None,
|
None,
|
||||||
self.volume_type.description,
|
self.volume_type.description,
|
||||||
@@ -724,7 +727,7 @@ class TestTypeShow(TestType):
|
|||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
private_type = volume_fakes.FakeType.create_one_type(
|
private_type = volume_fakes.FakeVolumeType.create_one_volume_type(
|
||||||
attrs={'is_public': False})
|
attrs={'is_public': False})
|
||||||
type_access_list = volume_fakes.FakeTypeAccess.create_one_type_access()
|
type_access_list = volume_fakes.FakeTypeAccess.create_one_type_access()
|
||||||
with mock.patch.object(self.types_mock, 'get',
|
with mock.patch.object(self.types_mock, 'get',
|
||||||
@@ -757,7 +760,7 @@ class TestTypeShow(TestType):
|
|||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
private_type = volume_fakes.FakeType.create_one_type(
|
private_type = volume_fakes.FakeVolumeType.create_one_volume_type(
|
||||||
attrs={'is_public': False})
|
attrs={'is_public': False})
|
||||||
with mock.patch.object(self.types_mock, 'get',
|
with mock.patch.object(self.types_mock, 'get',
|
||||||
return_value=private_type):
|
return_value=private_type):
|
||||||
@@ -781,14 +784,15 @@ class TestTypeShow(TestType):
|
|||||||
self.assertItemsEqual(private_type_data, data)
|
self.assertItemsEqual(private_type_data, data)
|
||||||
|
|
||||||
def test_type_show_with_encryption(self):
|
def test_type_show_with_encryption(self):
|
||||||
encryption_type = volume_fakes.FakeType.create_one_encryption_type()
|
encryption_type = \
|
||||||
|
volume_fakes.FakeVolumeType.create_one_encryption_volume_type()
|
||||||
encryption_info = {
|
encryption_info = {
|
||||||
'provider': 'LuksEncryptor',
|
'provider': 'LuksEncryptor',
|
||||||
'cipher': None,
|
'cipher': None,
|
||||||
'key_size': None,
|
'key_size': None,
|
||||||
'control_location': 'front-end',
|
'control_location': 'front-end',
|
||||||
}
|
}
|
||||||
self.volume_type = volume_fakes.FakeType.create_one_type(
|
self.volume_type = volume_fakes.FakeVolumeType.create_one_volume_type(
|
||||||
attrs={'encryption': encryption_info})
|
attrs={'encryption': encryption_info})
|
||||||
self.types_mock.get.return_value = self.volume_type
|
self.types_mock.get.return_value = self.volume_type
|
||||||
self.encryption_types_mock.get.return_value = encryption_type
|
self.encryption_types_mock.get.return_value = encryption_type
|
||||||
@@ -830,7 +834,7 @@ class TestTypeShow(TestType):
|
|||||||
class TestTypeUnset(TestType):
|
class TestTypeUnset(TestType):
|
||||||
|
|
||||||
project = identity_fakes.FakeProject.create_one_project()
|
project = identity_fakes.FakeProject.create_one_project()
|
||||||
volume_type = volume_fakes.FakeType.create_one_type(
|
volume_type = volume_fakes.FakeVolumeType.create_one_volume_type(
|
||||||
methods={'unset_keys': None})
|
methods={'unset_keys': None})
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@@ -932,7 +936,7 @@ class TestTypeUnset(TestType):
|
|||||||
class TestColumns(TestType):
|
class TestColumns(TestType):
|
||||||
|
|
||||||
def test_encryption_info_column_with_info(self):
|
def test_encryption_info_column_with_info(self):
|
||||||
fake_volume_type = volume_fakes.FakeType.create_one_type()
|
fake_volume_type = volume_fakes.FakeVolumeType.create_one_volume_type()
|
||||||
type_id = fake_volume_type.id
|
type_id = fake_volume_type.id
|
||||||
|
|
||||||
encryption_info = {
|
encryption_info = {
|
||||||
@@ -948,7 +952,7 @@ class TestColumns(TestType):
|
|||||||
self.assertEqual(encryption_info, col.machine_readable())
|
self.assertEqual(encryption_info, col.machine_readable())
|
||||||
|
|
||||||
def test_encryption_info_column_without_info(self):
|
def test_encryption_info_column_without_info(self):
|
||||||
fake_volume_type = volume_fakes.FakeType.create_one_type()
|
fake_volume_type = volume_fakes.FakeVolumeType.create_one_volume_type()
|
||||||
type_id = fake_volume_type.id
|
type_id = fake_volume_type.id
|
||||||
|
|
||||||
col = volume_type.EncryptionInfoColumn(type_id, {})
|
col = volume_type.EncryptionInfoColumn(type_id, {})
|
||||||
|
@@ -1173,7 +1173,7 @@ class TestVolumeMigrate(TestVolume):
|
|||||||
|
|
||||||
class TestVolumeSet(TestVolume):
|
class TestVolumeSet(TestVolume):
|
||||||
|
|
||||||
volume_type = volume_fakes.FakeType.create_one_type()
|
volume_type = volume_fakes.FakeVolumeType.create_one_volume_type()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestVolumeSet, self).setUp()
|
super(TestVolumeSet, self).setUp()
|
||||||
|
Reference in New Issue
Block a user