Skip to content

Commit 527b203

Browse files
author
zheng yin
committed
Add notes, modify notes in fakes docstring
Some code has no notes, then add them Some code notes are not perfect, then improve them Some code notes are incorrect, then modify them Change-Id: I43f9a8663ae138bdd494bc234c1fac00c2dd6c95
1 parent ffb232a commit 527b203

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

  • openstackclient/tests/compute/v2

openstackclient/tests/compute/v2/fakes.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ def create_one_aggregate(attrs=None):
8181
"availability_zone": "ag_zone",
8282
}
8383
}
84+
85+
# Overwrite default attributes.
8486
aggregate_info.update(attrs)
87+
8588
aggregate = fakes.FakeResource(
8689
info=copy.deepcopy(aggregate_info),
8790
loaded=True)
@@ -254,6 +257,8 @@ def create_one_agent(attrs=None):
254257
'md5hash': 'agent-md5hash',
255258
'hypervisor': 'hypervisor',
256259
}
260+
261+
# Overwrite default attributes.
257262
agent_info.update(attrs)
258263

259264
agent = fakes.FakeResource(info=copy.deepcopy(agent_info),
@@ -412,6 +417,8 @@ def create_one_hypervisor_stats(attrs=None):
412417
'vcpus': 8,
413418
'vcpus_used': 3,
414419
}
420+
421+
# Overwrite default attributes.
415422
stats_info.update(attrs)
416423

417424
# Set default method.
@@ -575,7 +582,7 @@ def create_one_server(attrs=None, methods=None):
575582
:param Dictionary methods:
576583
A dictionary with all methods
577584
:return:
578-
A FakeResource object, with id, name, metadata
585+
A FakeResource object, with id, name, metadata, and so on
579586
"""
580587
attrs = attrs or {}
581588
methods = methods or {}
@@ -651,7 +658,7 @@ def create_one_service(attrs=None):
651658
:param Dictionary attrs:
652659
A dictionary with all attributes
653660
:return:
654-
A FakeResource object, with id, host, binary
661+
A FakeResource object, with id, host, binary, and so on
655662
"""
656663
attrs = attrs or {}
657664

@@ -703,7 +710,7 @@ def create_one_flavor(attrs=None):
703710
:param Dictionary attrs:
704711
A dictionary with all attributes
705712
:return:
706-
A FakeResource object, with id, name, ram, vcpus, properties
713+
A FakeResource object, with id, name, ram, vcpus, and so on
707714
"""
708715
attrs = attrs or {}
709716

@@ -790,7 +797,7 @@ def create_one_keypair(attrs=None, no_pri=False):
790797
:param Dictionary attrs:
791798
A dictionary with all attributes
792799
:return:
793-
A FakeResource
800+
A FakeResource object, name, fingerprint, and so on
794801
"""
795802
attrs = attrs or {}
796803

@@ -984,7 +991,7 @@ def create_one_floating_ip_pool(attrs=None):
984991
:param Dictionary attrs:
985992
A dictionary with all attributes
986993
:return:
987-
A FakeResource object, with id, etc
994+
A FakeResource object, with name, etc
988995
"""
989996
if attrs is None:
990997
attrs = {}
@@ -1127,7 +1134,7 @@ def create_one_host(attrs=None):
11271134
:param Dictionary attrs:
11281135
A dictionary with all attributes
11291136
:return:
1130-
A FakeResource object, with id and other attributes
1137+
A FakeResource object, with uuid and other attributes
11311138
"""
11321139
attrs = attrs or {}
11331140

@@ -1183,6 +1190,7 @@ def create_one_server_group(attrs=None):
11831190
if attrs is None:
11841191
attrs = {}
11851192

1193+
# Set default attributes.
11861194
server_group_info = {
11871195
'id': 'server-group-id-' + uuid.uuid4().hex,
11881196
'members': [],
@@ -1192,7 +1200,10 @@ def create_one_server_group(attrs=None):
11921200
'project_id': 'server-group-project-id-' + uuid.uuid4().hex,
11931201
'user_id': 'server-group-user-id-' + uuid.uuid4().hex,
11941202
}
1203+
1204+
# Overwrite default attributes.
11951205
server_group_info.update(attrs)
1206+
11961207
server_group = fakes.FakeResource(
11971208
info=copy.deepcopy(server_group_info),
11981209
loaded=True)

0 commit comments

Comments
 (0)