summaryrefslogtreecommitdiff
path: root/openstackclient/tests/compute/v2/fakes.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-03-30 23:21:36 +0000
committerGerrit Code Review <review@openstack.org>2016-03-30 23:21:37 +0000
commit01b2a0c49f5ca32bd7cbdf99dfc39ad7ceece226 (patch)
tree05465900d1ed12d7414b29d624907b7607e98fc6 /openstackclient/tests/compute/v2/fakes.py
parenta73926556f267c3b1e2dc67279677c7938225aa9 (diff)
parent4cbcd02a5787f402a95c84da613d3f8cd7d09312 (diff)
downloadpython-openstackclient-01b2a0c49f5ca32bd7cbdf99dfc39ad7ceece226.tar.gz
Merge "Add "aggregate unset" to osc"
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 fe9b3c75..860963eb 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):