2020# FIXME(stephenfin): We are using v3 resource versions despite being v2 fakes
2121from cinderclient import api_versions
2222from openstack .block_storage .v2 import _proxy as block_storage_v2_proxy
23- from openstack .block_storage .v3 import backup as _backup
23+ from openstack .block_storage .v2 import backup as _backup
2424from openstack .block_storage .v3 import capabilities as _capabilities
2525from openstack .block_storage .v3 import stats as _stats
2626from openstack .block_storage .v3 import volume as _volume
@@ -514,34 +514,29 @@ def create_one_backup(attrs=None):
514514
515515 :param dict attrs:
516516 A dictionary with all attributes
517- :return:
518- A FakeResource object with id, name, volume_id, etc.
517+ :return: A fake
518+ openstack.block_storage.v2.backup.Backup object
519519 """
520520 attrs = attrs or {}
521521
522522 # Set default attributes.
523523 backup_info = {
524+ "availability_zone" : 'zone' + uuid .uuid4 ().hex ,
525+ "container" : 'container-' + uuid .uuid4 ().hex ,
524526 "created_at" : 'time-' + uuid .uuid4 ().hex ,
525527 "data_timestamp" : 'time-' + uuid .uuid4 ().hex ,
526- "id" : 'backup-id-' + uuid .uuid4 ().hex ,
527- "encryption_key_id" : None ,
528+ "description" : 'description-' + uuid .uuid4 ().hex ,
528529 "fail_reason" : "Service not found for creating backup." ,
529530 "has_dependent_backups" : False ,
531+ "id" : 'backup-id-' + uuid .uuid4 ().hex ,
530532 "is_incremental" : False ,
531- "metadata" : {},
532- "project_id" : uuid .uuid4 ().hex ,
533- "updated_at" : 'time-' + uuid .uuid4 ().hex ,
534- "user_id" : uuid .uuid4 ().hex ,
535533 "name" : 'backup-name-' + uuid .uuid4 ().hex ,
536- "volume_id" : 'volume-id-' + uuid .uuid4 ().hex ,
537- "snapshot_id" : 'snapshot-id' + uuid .uuid4 ().hex ,
538- "description" : 'description-' + uuid .uuid4 ().hex ,
539534 "object_count" : None ,
540- "container" : 'container-' + uuid .uuid4 ().hex ,
541535 "size" : random .randint (1 , 20 ),
542- "is_incremental " : False ,
536+ "snapshot_id " : 'snapshot-id' + uuid . uuid4 (). hex ,
543537 "status" : "error" ,
544- "availability_zone" : 'zone' + uuid .uuid4 ().hex ,
538+ "updated_at" : 'time-' + uuid .uuid4 ().hex ,
539+ "volume_id" : 'volume-id-' + uuid .uuid4 ().hex ,
545540 }
546541
547542 # Overwrite default attributes.
@@ -558,8 +553,8 @@ def create_backups(attrs=None, count=2):
558553 A dictionary with all attributes
559554 :param int count:
560555 The number of backups to fake
561- :return:
562- A list of FakeResource objects faking the backups
556+ :return: A list of fake
557+ openstack.block_storage.v2.backup.Backup objects
563558 """
564559 backups = []
565560 for i in range (0 , count ):
0 commit comments