From b0c317ebdd5e5f2626ce2fbd495149336fe5df7e Mon Sep 17 00:00:00 2001 From: Huanxuan Ao Date: Thu, 7 Jul 2016 21:27:22 +0800 Subject: 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 --- openstackclient/tests/compute/v2/fakes.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'openstackclient/tests/compute/v2/fakes.py') 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.""" -- cgit v1.2.1