Merge "Add notes, modify notes in fakes docstring"

This commit is contained in:
Jenkins 2016-07-11 03:44:27 +00:00 committed by Gerrit Code Review
commit 00a15351eb

View File

@ -81,7 +81,10 @@ class FakeAggregate(object):
"availability_zone": "ag_zone", "availability_zone": "ag_zone",
} }
} }
# Overwrite default attributes.
aggregate_info.update(attrs) aggregate_info.update(attrs)
aggregate = fakes.FakeResource( aggregate = fakes.FakeResource(
info=copy.deepcopy(aggregate_info), info=copy.deepcopy(aggregate_info),
loaded=True) loaded=True)
@ -254,6 +257,8 @@ class FakeAgent(object):
'md5hash': 'agent-md5hash', 'md5hash': 'agent-md5hash',
'hypervisor': 'hypervisor', 'hypervisor': 'hypervisor',
} }
# Overwrite default attributes.
agent_info.update(attrs) agent_info.update(attrs)
agent = fakes.FakeResource(info=copy.deepcopy(agent_info), agent = fakes.FakeResource(info=copy.deepcopy(agent_info),
@ -412,6 +417,8 @@ class FakeHypervisorStats(object):
'vcpus': 8, 'vcpus': 8,
'vcpus_used': 3, 'vcpus_used': 3,
} }
# Overwrite default attributes.
stats_info.update(attrs) stats_info.update(attrs)
# Set default method. # Set default method.
@ -575,7 +582,7 @@ class FakeServer(object):
:param Dictionary methods: :param Dictionary methods:
A dictionary with all methods A dictionary with all methods
:return: :return:
A FakeResource object, with id, name, metadata A FakeResource object, with id, name, metadata, and so on
""" """
attrs = attrs or {} attrs = attrs or {}
methods = methods or {} methods = methods or {}
@ -651,7 +658,7 @@ class FakeService(object):
:param Dictionary attrs: :param Dictionary attrs:
A dictionary with all attributes A dictionary with all attributes
:return: :return:
A FakeResource object, with id, host, binary A FakeResource object, with id, host, binary, and so on
""" """
attrs = attrs or {} attrs = attrs or {}
@ -703,7 +710,7 @@ class FakeFlavor(object):
:param Dictionary attrs: :param Dictionary attrs:
A dictionary with all attributes A dictionary with all attributes
:return: :return:
A FakeResource object, with id, name, ram, vcpus, properties A FakeResource object, with id, name, ram, vcpus, and so on
""" """
attrs = attrs or {} attrs = attrs or {}
@ -790,7 +797,7 @@ class FakeKeypair(object):
:param Dictionary attrs: :param Dictionary attrs:
A dictionary with all attributes A dictionary with all attributes
:return: :return:
A FakeResource A FakeResource object, name, fingerprint, and so on
""" """
attrs = attrs or {} attrs = attrs or {}
@ -984,7 +991,7 @@ class FakeFloatingIPPool(object):
:param Dictionary attrs: :param Dictionary attrs:
A dictionary with all attributes A dictionary with all attributes
:return: :return:
A FakeResource object, with id, etc A FakeResource object, with name, etc
""" """
if attrs is None: if attrs is None:
attrs = {} attrs = {}
@ -1127,7 +1134,7 @@ class FakeHost(object):
:param Dictionary attrs: :param Dictionary attrs:
A dictionary with all attributes A dictionary with all attributes
:return: :return:
A FakeResource object, with id and other attributes A FakeResource object, with uuid and other attributes
""" """
attrs = attrs or {} attrs = attrs or {}
@ -1183,6 +1190,7 @@ class FakeServerGroup(object):
if attrs is None: if attrs is None:
attrs = {} attrs = {}
# Set default attributes.
server_group_info = { server_group_info = {
'id': 'server-group-id-' + uuid.uuid4().hex, 'id': 'server-group-id-' + uuid.uuid4().hex,
'members': [], 'members': [],
@ -1192,7 +1200,10 @@ class FakeServerGroup(object):
'project_id': 'server-group-project-id-' + uuid.uuid4().hex, 'project_id': 'server-group-project-id-' + uuid.uuid4().hex,
'user_id': 'server-group-user-id-' + uuid.uuid4().hex, 'user_id': 'server-group-user-id-' + uuid.uuid4().hex,
} }
# Overwrite default attributes.
server_group_info.update(attrs) server_group_info.update(attrs)
server_group = fakes.FakeResource( server_group = fakes.FakeResource(
info=copy.deepcopy(server_group_info), info=copy.deepcopy(server_group_info),
loaded=True) loaded=True)