summaryrefslogtreecommitdiff
path: root/openstackclient/tests/compute/v2/fakes.py
diff options
context:
space:
mode:
authorRui Chen <chenrui.momo@gmail.com>2016-03-21 16:29:14 +0800
committerRui Chen <chenrui.momo@gmail.com>2016-03-24 10:33:23 +0800
commit4cbcd02a5787f402a95c84da613d3f8cd7d09312 (patch)
tree1280129ea1798fe1c4fc14d1896f7fc1409b192c /openstackclient/tests/compute/v2/fakes.py
parent4b4349ee6821f08fb1483d5281d568081649a0d9 (diff)
downloadpython-openstackclient-4cbcd02a5787f402a95c84da613d3f8cd7d09312.tar.gz
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
Diffstat (limited to 'openstackclient/tests/compute/v2/fakes.py')
-rw-r--r--openstackclient/tests/compute/v2/fakes.py32
1 files changed, 32 insertions, 0 deletions
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):