summaryrefslogtreecommitdiff
path: root/openstackclient/tests/compute/v2/fakes.py
diff options
context:
space:
mode:
authorHuanxuan Ao <huanxuan.ao@easystack.cn>2016-07-07 21:27:22 +0800
committerHuanxuan Ao <huanxuan.ao@easystack.cn>2016-07-22 10:20:18 +0800
commitb0c317ebdd5e5f2626ce2fbd495149336fe5df7e (patch)
treeb9f1430430d6c0ba3bca9f023341b7f61c8f3729 /openstackclient/tests/compute/v2/fakes.py
parent55c1c575d63f4e9e6fc3f4dbb6c572e841b513d9 (diff)
downloadpython-openstackclient-b0c317ebdd5e5f2626ce2fbd495149336fe5df7e.tar.gz
Add Support for showing flavor access list
Add a attribute "access_project_id" for flavor object to display the access project id list by using "flavor show" command. Change-Id: I7f0c152b816e0ca2e32e47f9b5c1aa7663d33b6d Closes-Bug:#1575461
Diffstat (limited to 'openstackclient/tests/compute/v2/fakes.py')
-rw-r--r--openstackclient/tests/compute/v2/fakes.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/openstackclient/tests/compute/v2/fakes.py b/openstackclient/tests/compute/v2/fakes.py
index 76402476..e40e62a7 100644
--- a/openstackclient/tests/compute/v2/fakes.py
+++ b/openstackclient/tests/compute/v2/fakes.py
@@ -787,6 +787,35 @@ class FakeFlavor(object):
return mock.MagicMock(side_effect=flavors)
+class FakeFlavorAccess(object):
+ """Fake one or more flavor accesses."""
+
+ @staticmethod
+ def create_one_flavor_access(attrs=None):
+ """Create a fake flavor access.
+
+ :param Dictionary attrs:
+ A dictionary with all attributes
+ :return:
+ A FakeResource object, with flavor_id, tenat_id
+ """
+ attrs = attrs or {}
+
+ # Set default attributes.
+ flavor_access_info = {
+ 'flavor_id': 'flavor-id-' + uuid.uuid4().hex,
+ 'tenant_id': 'tenant-id-' + uuid.uuid4().hex,
+ }
+
+ # Overwrite default attributes.
+ flavor_access_info.update(attrs)
+
+ flavor_access = fakes.FakeResource(
+ info=copy.deepcopy(flavor_access_info), loaded=True)
+
+ return flavor_access
+
+
class FakeKeypair(object):
"""Fake one or more keypairs."""