@@ -50,14 +50,8 @@ def __init__(self, **kwargs):
5050 self .services .resource_class = fakes .FakeResource (None , {})
5151 self .transfers = mock .Mock ()
5252 self .transfers .resource_class = fakes .FakeResource (None , {})
53- self .volume_encryption_types = mock .Mock ()
54- self .volume_encryption_types .resource_class = fakes .FakeResource (
55- None , {}
56- )
5753 self .volume_snapshots = mock .Mock ()
5854 self .volume_snapshots .resource_class = fakes .FakeResource (None , {})
59- self .volume_type_access = mock .Mock ()
60- self .volume_type_access .resource_class = fakes .FakeResource (None , {})
6155 self .volume_types = mock .Mock ()
6256 self .volume_types .resource_class = fakes .FakeResource (None , {})
6357 self .volumes = mock .Mock ()
@@ -179,31 +173,6 @@ def get_transfers(transfers=None, count=2):
179173 return mock .Mock (side_effect = transfers )
180174
181175
182- def create_one_type_access (attrs = None ):
183- """Create a fake volume type access for project.
184-
185- :param dict attrs:
186- A dictionary with all attributes
187- :return:
188- A FakeResource object, with Volume_type_ID and Project_ID.
189- """
190- if attrs is None :
191- attrs = {}
192-
193- # Set default attributes.
194- type_access_attrs = {
195- 'volume_type_id' : 'volume-type-id-' + uuid .uuid4 ().hex ,
196- 'project_id' : 'project-id-' + uuid .uuid4 ().hex ,
197- }
198-
199- # Overwrite default attributes.
200- type_access_attrs .update (attrs )
201-
202- type_access = fakes .FakeResource (None , type_access_attrs , loaded = True )
203-
204- return type_access
205-
206-
207176def create_one_service (attrs = None ):
208177 """Create a fake service.
209178
@@ -788,69 +757,3 @@ def create_one_volume_type(attrs=None, methods=None):
788757 info = copy .deepcopy (volume_type_info ), methods = methods , loaded = True
789758 )
790759 return volume_type
791-
792-
793- def create_volume_types (attrs = None , count = 2 ):
794- """Create multiple fake volume_types.
795-
796- :param dict attrs:
797- A dictionary with all attributes
798- :param int count:
799- The number of types to fake
800- :return:
801- A list of FakeResource objects faking the types
802- """
803- volume_types = []
804- for i in range (0 , count ):
805- volume_type = create_one_volume_type (attrs )
806- volume_types .append (volume_type )
807-
808- return volume_types
809-
810-
811- def get_volume_types (volume_types = None , count = 2 ):
812- """Get an iterable MagicMock object with a list of faked volume types.
813-
814- If volume_types list is provided, then initialize the Mock object with
815- the list. Otherwise create one.
816-
817- :param List volume_types:
818- A list of FakeResource objects faking volume types
819- :param Integer count:
820- The number of volume types to be faked
821- :return
822- An iterable Mock object with side_effect set to a list of faked
823- volume types
824- """
825- if volume_types is None :
826- volume_types = create_volume_types (count )
827-
828- return mock .Mock (side_effect = volume_types )
829-
830-
831- def create_one_encryption_volume_type (attrs = None ):
832- """Create a fake encryption volume type.
833-
834- :param dict attrs:
835- A dictionary with all attributes
836- :return:
837- A FakeResource object with volume_type_id etc.
838- """
839- attrs = attrs or {}
840-
841- # Set default attributes.
842- encryption_info = {
843- "volume_type_id" : 'type-id-' + uuid .uuid4 ().hex ,
844- 'provider' : 'LuksEncryptor' ,
845- 'cipher' : None ,
846- 'key_size' : None ,
847- 'control_location' : 'front-end' ,
848- }
849-
850- # Overwrite default attributes.
851- encryption_info .update (attrs )
852-
853- encryption_type = fakes .FakeResource (
854- info = copy .deepcopy (encryption_info ), loaded = True
855- )
856- return encryption_type
0 commit comments