From 4cbcd02a5787f402a95c84da613d3f8cd7d09312 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Mon, 21 Mar 2016 16:29:14 +0800 Subject: Add "aggregate unset" to osc Support "aggregate unset" command in order to remove the property of aggregate object in OSC. Change-Id: I49645135586362f0fd251f5e4a4c03eff273d9e9 Closes-Bug: #1559866 --- openstackclient/tests/compute/v2/fakes.py | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 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 809825d0..2bb0fbfc 100644 --- a/openstackclient/tests/compute/v2/fakes.py +++ b/openstackclient/tests/compute/v2/fakes.py @@ -88,6 +88,38 @@ SERVICE = { } +class FakeAggregate(object): + """Fake one aggregate.""" + + @staticmethod + def create_one_aggregate(attrs=None): + """Create a fake aggregate. + + :param Dictionary attrs: + A dictionary with all attributes + :return: + A FakeResource object, with id and other attributes + """ + if attrs is None: + attrs = {} + + # Set default attribute + aggregate_info = { + "name": "aggregate-name-" + uuid.uuid4().hex, + "availability_zone": "ag_zone", + "hosts": [], + "id": "aggregate-id-" + uuid.uuid4().hex, + "metadata": { + "availability_zone": "ag_zone", + } + } + aggregate_info.update(attrs) + aggregate = fakes.FakeResource( + info=copy.deepcopy(aggregate_info), + loaded=True) + return aggregate + + class FakeComputev2Client(object): def __init__(self, **kwargs): -- cgit v1.2.1